Optimize Multiple Insert SQLite Coming From MySQLOptimize JSON insertion to SQLite (insert … on duplicate...
How can I install sudo without using su?
Why zero tolerance on nudity in space?
Why do stocks necessarily drop during a recession?
Why does String.replaceAll() work differently in Java 8 from Java 9?
difference between two quite-similar Terminal commands
Calculate Contact age in a Drupal view
What kind of hardware implements Fourier transform?
Why do members of Congress in committee hearings ask witnesses the same question multiple times?
Why avoid shared user accounts?
Contest math problem about crossing out numbers in the table
We are very unlucky in my court
Am I a Rude Number?
What is the most triangles you can make from a capital "H" and 3 straight lines?
Typing Amharic inside a math equation?
Why did other German political parties disband so fast when Hitler was appointed chancellor?
Strange Sign on Lab Door
How to fill color in logic gates in Tikz?
If I delete my router's history can my ISP still provide it to my parents?
Does Improved Divine Strike trigger when a paladin makes an unarmed strike?
Why are the books in the Game of Thrones citadel library shelved spine inwards?
Is there any differences between "Gucken" and "Schauen"?
Using only 1s, make 29 with the minimum number of digits
Find x angle in triangle
What is the in-universe cost of a TIE fighter?
Optimize Multiple Insert SQLite Coming From MySQL
Optimize JSON insertion to SQLite (insert … on duplicate key ignore)Insert dynamic parameters to sqlite database statementsSimplify MySQL INSERT queryoptimize mysql taking too longListview from SQLiteImplementation of stackPulling from data from SQLite DB on AndroidMysql multiple queries from one PHP fileC++ SQLite insert statementinsert multiple tag
$begingroup$
I'm currently developing an app that requires sending and receiving of data from android studio going to MySQL and then data coming from MySQL will be saved from the SQLite. I need advice on how to make the process faster. Right now I'm inserting 80,000 + rows of data coming from MySQL and then saving it to SQLite and that process lasts around 25-30 minutes. The sending/recieving of data will happen once the button is clicked.
This is my PHP file
rowItem.php
<?php
require "init.php";
$serial = $_POST['mySerial'];
$sql = "select ITEMCODE, DESCRIPTION, BRAND from items where SERIAL_NO = '" .$serial. "'";
$result = mysqli_query($con, $sql);
$data =array();
while($row = mysqli_fetch_array($result)) {
$row['ITEMCODE'] = mb_convert_encoding($row['ITEMCODE'], 'UTF-8', 'UTF-8');
$row['DESCRIPTION'] = mb_convert_encoding($row['DESCRIPTION'], 'UTF-8', 'UTF-8');
$row['BRAND'] = mb_convert_encoding($row['BRAND'], 'UTF-8', 'UTF-8');
array_push($data, array('ITEMCODE' => $row['ITEMCODE'], 'DESCRIPTION' => $row['DESCRIPTION'], 'BRAND' => $row['BRAND']));
}
$json = json_encode(array("allItems"=>$data));
echo $json;
?>
This are my Java codes
DatabaseOperations.java
public class DatabaseOperations extends SQLiteOpenHelper {
public static final int dbVersion = 1;
public String CREATE_ITEMS_TABLE = "CREATE TABLE " + TableData.TableInfo.TB_ITEMS +
" (" + TableData.TableInfo.COL_ITEMS_ITEMCODE + " VARCHAR(20) PRIMARY KEY NOT NULL, " +
TableData.TableInfo.COL_ITEMS_DESCRIPTION + " VARCHAR(50), " +
TableData.TableInfo.COL_ITEMS_BRAND + " VARCHAR(10), " +
TableData.TableInfo.COL_ITEMS_BARCODE + " VARCHAR(20));";
public DatabaseOperations(Context context) {
super(context, TableData.TableInfo.DB_NAME, null, dbVersion);
}
@Override
public void onCreate(SQLiteDatabase sdb) {
sdb.execSQL(CREATE_ITEMS_TABLE);
}
public void insertItems (DatabaseOperations dop,
String itemCode, String brand, String desc) {
SQLiteDatabase sq = dop.getWritableDatabase();
sq.beginTransaction();
try {
ContentValues cv = new ContentValues();
cv.put(TableData.TableInfo.COL_ITEMS_ITEMCODE, itemCode);
cv.put(TableData.TableInfo.COL_ITEMS_BRAND, brand);
cv.put(TableData.TableInfo.COL_ITEMS_DESCRIPTION, desc);
sq.insert(TableData.TableInfo.TB_ITEMS, null, cv);
sq.setTransactionSuccessful();
}
catch (Exception e) {
}
finally {
sq.endTransaction();
sq.close();
}
}
}
MainScreen.java
public class MainScreen extends AppCompatActivity {
Context ctx = this;
Button btnSync;
String rowItemURL = "http://192.168.100.118:81/rowItem.php";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_screen);
btnSync = findViewById(R.id.btnSync);
btnSync.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
StringRequest itemImeiRequest = new StringRequest(Request.Method.POST, rowItemURL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonObject;
jsonObject = new JSONObject(response);
JSONArray itemArray = jsonObject.getJSONArray("allItems");
for (int i = 0; i < itemArray.length(); i++) {
itemCode = itemArray.getJSONObject(i).getString("ITEMCODE");
itemBrand = itemArray.getJSONObject(i).getString("BRAND");
itemDesc = itemArray.getJSONObject(i).getString("DESCRIPTION");
DatabaseOperations dop = new DatabaseOperations(ctx);
dop.insertItems(dop, itemCode, itemBrand, itemDesc);
}
Toast.makeText(ctx, "SYNC ITEMS COMPLETED!", Toast.LENGTH_LONG).show();
lblDebug.setText("SUCCESS!");
}
catch (JSONException e) {
Toast.makeText(ctx, e.getMessage(), Toast.LENGTH_LONG).show();
lblDebug.setText(e.getMessage() + "500");
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(ctx, error.getMessage(), Toast.LENGTH_LONG).show();
lblDebug.setText(error.getMessage() + "511");
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
SharedPreferences sharedPreferencesIMEI = getSharedPreferences(IMEI_PREF, MODE_PRIVATE);
myIMEI = sharedPreferencesIMEI.getString(TEXT5, "");
Map<String,String> params = new HashMap<>();
params.put("mySerial", myIMEI);
return params;
}
};
MySingleton.getInstance(MainScreen.this).addToRequestQue(itemImeiRequest);
}
}
}
}
MySingleton.java
public class MySingleton {
private static MySingleton mInstance;
private RequestQueue requestQueue;
private static Context mCtx;
private MySingleton(Context context) {
mCtx = context;
requestQueue = getRequestQueue();
}
public RequestQueue getRequestQueue(){
if(requestQueue==null) {
requestQueue = Volley.newRequestQueue(mCtx.getApplicationContext());
}
return requestQueue;
}
public static synchronized MySingleton getInstance(Context context) {
if(mInstance==null) {
mInstance = new MySingleton(context);
}
return mInstance;
}
public<T> void addToRequestQue(Request<T> request) {
requestQueue.add(request);
}
}
java php mysql android sqlite
New contributor
$endgroup$
add a comment |
$begingroup$
I'm currently developing an app that requires sending and receiving of data from android studio going to MySQL and then data coming from MySQL will be saved from the SQLite. I need advice on how to make the process faster. Right now I'm inserting 80,000 + rows of data coming from MySQL and then saving it to SQLite and that process lasts around 25-30 minutes. The sending/recieving of data will happen once the button is clicked.
This is my PHP file
rowItem.php
<?php
require "init.php";
$serial = $_POST['mySerial'];
$sql = "select ITEMCODE, DESCRIPTION, BRAND from items where SERIAL_NO = '" .$serial. "'";
$result = mysqli_query($con, $sql);
$data =array();
while($row = mysqli_fetch_array($result)) {
$row['ITEMCODE'] = mb_convert_encoding($row['ITEMCODE'], 'UTF-8', 'UTF-8');
$row['DESCRIPTION'] = mb_convert_encoding($row['DESCRIPTION'], 'UTF-8', 'UTF-8');
$row['BRAND'] = mb_convert_encoding($row['BRAND'], 'UTF-8', 'UTF-8');
array_push($data, array('ITEMCODE' => $row['ITEMCODE'], 'DESCRIPTION' => $row['DESCRIPTION'], 'BRAND' => $row['BRAND']));
}
$json = json_encode(array("allItems"=>$data));
echo $json;
?>
This are my Java codes
DatabaseOperations.java
public class DatabaseOperations extends SQLiteOpenHelper {
public static final int dbVersion = 1;
public String CREATE_ITEMS_TABLE = "CREATE TABLE " + TableData.TableInfo.TB_ITEMS +
" (" + TableData.TableInfo.COL_ITEMS_ITEMCODE + " VARCHAR(20) PRIMARY KEY NOT NULL, " +
TableData.TableInfo.COL_ITEMS_DESCRIPTION + " VARCHAR(50), " +
TableData.TableInfo.COL_ITEMS_BRAND + " VARCHAR(10), " +
TableData.TableInfo.COL_ITEMS_BARCODE + " VARCHAR(20));";
public DatabaseOperations(Context context) {
super(context, TableData.TableInfo.DB_NAME, null, dbVersion);
}
@Override
public void onCreate(SQLiteDatabase sdb) {
sdb.execSQL(CREATE_ITEMS_TABLE);
}
public void insertItems (DatabaseOperations dop,
String itemCode, String brand, String desc) {
SQLiteDatabase sq = dop.getWritableDatabase();
sq.beginTransaction();
try {
ContentValues cv = new ContentValues();
cv.put(TableData.TableInfo.COL_ITEMS_ITEMCODE, itemCode);
cv.put(TableData.TableInfo.COL_ITEMS_BRAND, brand);
cv.put(TableData.TableInfo.COL_ITEMS_DESCRIPTION, desc);
sq.insert(TableData.TableInfo.TB_ITEMS, null, cv);
sq.setTransactionSuccessful();
}
catch (Exception e) {
}
finally {
sq.endTransaction();
sq.close();
}
}
}
MainScreen.java
public class MainScreen extends AppCompatActivity {
Context ctx = this;
Button btnSync;
String rowItemURL = "http://192.168.100.118:81/rowItem.php";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_screen);
btnSync = findViewById(R.id.btnSync);
btnSync.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
StringRequest itemImeiRequest = new StringRequest(Request.Method.POST, rowItemURL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonObject;
jsonObject = new JSONObject(response);
JSONArray itemArray = jsonObject.getJSONArray("allItems");
for (int i = 0; i < itemArray.length(); i++) {
itemCode = itemArray.getJSONObject(i).getString("ITEMCODE");
itemBrand = itemArray.getJSONObject(i).getString("BRAND");
itemDesc = itemArray.getJSONObject(i).getString("DESCRIPTION");
DatabaseOperations dop = new DatabaseOperations(ctx);
dop.insertItems(dop, itemCode, itemBrand, itemDesc);
}
Toast.makeText(ctx, "SYNC ITEMS COMPLETED!", Toast.LENGTH_LONG).show();
lblDebug.setText("SUCCESS!");
}
catch (JSONException e) {
Toast.makeText(ctx, e.getMessage(), Toast.LENGTH_LONG).show();
lblDebug.setText(e.getMessage() + "500");
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(ctx, error.getMessage(), Toast.LENGTH_LONG).show();
lblDebug.setText(error.getMessage() + "511");
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
SharedPreferences sharedPreferencesIMEI = getSharedPreferences(IMEI_PREF, MODE_PRIVATE);
myIMEI = sharedPreferencesIMEI.getString(TEXT5, "");
Map<String,String> params = new HashMap<>();
params.put("mySerial", myIMEI);
return params;
}
};
MySingleton.getInstance(MainScreen.this).addToRequestQue(itemImeiRequest);
}
}
}
}
MySingleton.java
public class MySingleton {
private static MySingleton mInstance;
private RequestQueue requestQueue;
private static Context mCtx;
private MySingleton(Context context) {
mCtx = context;
requestQueue = getRequestQueue();
}
public RequestQueue getRequestQueue(){
if(requestQueue==null) {
requestQueue = Volley.newRequestQueue(mCtx.getApplicationContext());
}
return requestQueue;
}
public static synchronized MySingleton getInstance(Context context) {
if(mInstance==null) {
mInstance = new MySingleton(context);
}
return mInstance;
}
public<T> void addToRequestQue(Request<T> request) {
requestQueue.add(request);
}
}
java php mysql android sqlite
New contributor
$endgroup$
add a comment |
$begingroup$
I'm currently developing an app that requires sending and receiving of data from android studio going to MySQL and then data coming from MySQL will be saved from the SQLite. I need advice on how to make the process faster. Right now I'm inserting 80,000 + rows of data coming from MySQL and then saving it to SQLite and that process lasts around 25-30 minutes. The sending/recieving of data will happen once the button is clicked.
This is my PHP file
rowItem.php
<?php
require "init.php";
$serial = $_POST['mySerial'];
$sql = "select ITEMCODE, DESCRIPTION, BRAND from items where SERIAL_NO = '" .$serial. "'";
$result = mysqli_query($con, $sql);
$data =array();
while($row = mysqli_fetch_array($result)) {
$row['ITEMCODE'] = mb_convert_encoding($row['ITEMCODE'], 'UTF-8', 'UTF-8');
$row['DESCRIPTION'] = mb_convert_encoding($row['DESCRIPTION'], 'UTF-8', 'UTF-8');
$row['BRAND'] = mb_convert_encoding($row['BRAND'], 'UTF-8', 'UTF-8');
array_push($data, array('ITEMCODE' => $row['ITEMCODE'], 'DESCRIPTION' => $row['DESCRIPTION'], 'BRAND' => $row['BRAND']));
}
$json = json_encode(array("allItems"=>$data));
echo $json;
?>
This are my Java codes
DatabaseOperations.java
public class DatabaseOperations extends SQLiteOpenHelper {
public static final int dbVersion = 1;
public String CREATE_ITEMS_TABLE = "CREATE TABLE " + TableData.TableInfo.TB_ITEMS +
" (" + TableData.TableInfo.COL_ITEMS_ITEMCODE + " VARCHAR(20) PRIMARY KEY NOT NULL, " +
TableData.TableInfo.COL_ITEMS_DESCRIPTION + " VARCHAR(50), " +
TableData.TableInfo.COL_ITEMS_BRAND + " VARCHAR(10), " +
TableData.TableInfo.COL_ITEMS_BARCODE + " VARCHAR(20));";
public DatabaseOperations(Context context) {
super(context, TableData.TableInfo.DB_NAME, null, dbVersion);
}
@Override
public void onCreate(SQLiteDatabase sdb) {
sdb.execSQL(CREATE_ITEMS_TABLE);
}
public void insertItems (DatabaseOperations dop,
String itemCode, String brand, String desc) {
SQLiteDatabase sq = dop.getWritableDatabase();
sq.beginTransaction();
try {
ContentValues cv = new ContentValues();
cv.put(TableData.TableInfo.COL_ITEMS_ITEMCODE, itemCode);
cv.put(TableData.TableInfo.COL_ITEMS_BRAND, brand);
cv.put(TableData.TableInfo.COL_ITEMS_DESCRIPTION, desc);
sq.insert(TableData.TableInfo.TB_ITEMS, null, cv);
sq.setTransactionSuccessful();
}
catch (Exception e) {
}
finally {
sq.endTransaction();
sq.close();
}
}
}
MainScreen.java
public class MainScreen extends AppCompatActivity {
Context ctx = this;
Button btnSync;
String rowItemURL = "http://192.168.100.118:81/rowItem.php";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_screen);
btnSync = findViewById(R.id.btnSync);
btnSync.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
StringRequest itemImeiRequest = new StringRequest(Request.Method.POST, rowItemURL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonObject;
jsonObject = new JSONObject(response);
JSONArray itemArray = jsonObject.getJSONArray("allItems");
for (int i = 0; i < itemArray.length(); i++) {
itemCode = itemArray.getJSONObject(i).getString("ITEMCODE");
itemBrand = itemArray.getJSONObject(i).getString("BRAND");
itemDesc = itemArray.getJSONObject(i).getString("DESCRIPTION");
DatabaseOperations dop = new DatabaseOperations(ctx);
dop.insertItems(dop, itemCode, itemBrand, itemDesc);
}
Toast.makeText(ctx, "SYNC ITEMS COMPLETED!", Toast.LENGTH_LONG).show();
lblDebug.setText("SUCCESS!");
}
catch (JSONException e) {
Toast.makeText(ctx, e.getMessage(), Toast.LENGTH_LONG).show();
lblDebug.setText(e.getMessage() + "500");
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(ctx, error.getMessage(), Toast.LENGTH_LONG).show();
lblDebug.setText(error.getMessage() + "511");
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
SharedPreferences sharedPreferencesIMEI = getSharedPreferences(IMEI_PREF, MODE_PRIVATE);
myIMEI = sharedPreferencesIMEI.getString(TEXT5, "");
Map<String,String> params = new HashMap<>();
params.put("mySerial", myIMEI);
return params;
}
};
MySingleton.getInstance(MainScreen.this).addToRequestQue(itemImeiRequest);
}
}
}
}
MySingleton.java
public class MySingleton {
private static MySingleton mInstance;
private RequestQueue requestQueue;
private static Context mCtx;
private MySingleton(Context context) {
mCtx = context;
requestQueue = getRequestQueue();
}
public RequestQueue getRequestQueue(){
if(requestQueue==null) {
requestQueue = Volley.newRequestQueue(mCtx.getApplicationContext());
}
return requestQueue;
}
public static synchronized MySingleton getInstance(Context context) {
if(mInstance==null) {
mInstance = new MySingleton(context);
}
return mInstance;
}
public<T> void addToRequestQue(Request<T> request) {
requestQueue.add(request);
}
}
java php mysql android sqlite
New contributor
$endgroup$
I'm currently developing an app that requires sending and receiving of data from android studio going to MySQL and then data coming from MySQL will be saved from the SQLite. I need advice on how to make the process faster. Right now I'm inserting 80,000 + rows of data coming from MySQL and then saving it to SQLite and that process lasts around 25-30 minutes. The sending/recieving of data will happen once the button is clicked.
This is my PHP file
rowItem.php
<?php
require "init.php";
$serial = $_POST['mySerial'];
$sql = "select ITEMCODE, DESCRIPTION, BRAND from items where SERIAL_NO = '" .$serial. "'";
$result = mysqli_query($con, $sql);
$data =array();
while($row = mysqli_fetch_array($result)) {
$row['ITEMCODE'] = mb_convert_encoding($row['ITEMCODE'], 'UTF-8', 'UTF-8');
$row['DESCRIPTION'] = mb_convert_encoding($row['DESCRIPTION'], 'UTF-8', 'UTF-8');
$row['BRAND'] = mb_convert_encoding($row['BRAND'], 'UTF-8', 'UTF-8');
array_push($data, array('ITEMCODE' => $row['ITEMCODE'], 'DESCRIPTION' => $row['DESCRIPTION'], 'BRAND' => $row['BRAND']));
}
$json = json_encode(array("allItems"=>$data));
echo $json;
?>
This are my Java codes
DatabaseOperations.java
public class DatabaseOperations extends SQLiteOpenHelper {
public static final int dbVersion = 1;
public String CREATE_ITEMS_TABLE = "CREATE TABLE " + TableData.TableInfo.TB_ITEMS +
" (" + TableData.TableInfo.COL_ITEMS_ITEMCODE + " VARCHAR(20) PRIMARY KEY NOT NULL, " +
TableData.TableInfo.COL_ITEMS_DESCRIPTION + " VARCHAR(50), " +
TableData.TableInfo.COL_ITEMS_BRAND + " VARCHAR(10), " +
TableData.TableInfo.COL_ITEMS_BARCODE + " VARCHAR(20));";
public DatabaseOperations(Context context) {
super(context, TableData.TableInfo.DB_NAME, null, dbVersion);
}
@Override
public void onCreate(SQLiteDatabase sdb) {
sdb.execSQL(CREATE_ITEMS_TABLE);
}
public void insertItems (DatabaseOperations dop,
String itemCode, String brand, String desc) {
SQLiteDatabase sq = dop.getWritableDatabase();
sq.beginTransaction();
try {
ContentValues cv = new ContentValues();
cv.put(TableData.TableInfo.COL_ITEMS_ITEMCODE, itemCode);
cv.put(TableData.TableInfo.COL_ITEMS_BRAND, brand);
cv.put(TableData.TableInfo.COL_ITEMS_DESCRIPTION, desc);
sq.insert(TableData.TableInfo.TB_ITEMS, null, cv);
sq.setTransactionSuccessful();
}
catch (Exception e) {
}
finally {
sq.endTransaction();
sq.close();
}
}
}
MainScreen.java
public class MainScreen extends AppCompatActivity {
Context ctx = this;
Button btnSync;
String rowItemURL = "http://192.168.100.118:81/rowItem.php";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_screen);
btnSync = findViewById(R.id.btnSync);
btnSync.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
StringRequest itemImeiRequest = new StringRequest(Request.Method.POST, rowItemURL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonObject;
jsonObject = new JSONObject(response);
JSONArray itemArray = jsonObject.getJSONArray("allItems");
for (int i = 0; i < itemArray.length(); i++) {
itemCode = itemArray.getJSONObject(i).getString("ITEMCODE");
itemBrand = itemArray.getJSONObject(i).getString("BRAND");
itemDesc = itemArray.getJSONObject(i).getString("DESCRIPTION");
DatabaseOperations dop = new DatabaseOperations(ctx);
dop.insertItems(dop, itemCode, itemBrand, itemDesc);
}
Toast.makeText(ctx, "SYNC ITEMS COMPLETED!", Toast.LENGTH_LONG).show();
lblDebug.setText("SUCCESS!");
}
catch (JSONException e) {
Toast.makeText(ctx, e.getMessage(), Toast.LENGTH_LONG).show();
lblDebug.setText(e.getMessage() + "500");
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(ctx, error.getMessage(), Toast.LENGTH_LONG).show();
lblDebug.setText(error.getMessage() + "511");
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
SharedPreferences sharedPreferencesIMEI = getSharedPreferences(IMEI_PREF, MODE_PRIVATE);
myIMEI = sharedPreferencesIMEI.getString(TEXT5, "");
Map<String,String> params = new HashMap<>();
params.put("mySerial", myIMEI);
return params;
}
};
MySingleton.getInstance(MainScreen.this).addToRequestQue(itemImeiRequest);
}
}
}
}
MySingleton.java
public class MySingleton {
private static MySingleton mInstance;
private RequestQueue requestQueue;
private static Context mCtx;
private MySingleton(Context context) {
mCtx = context;
requestQueue = getRequestQueue();
}
public RequestQueue getRequestQueue(){
if(requestQueue==null) {
requestQueue = Volley.newRequestQueue(mCtx.getApplicationContext());
}
return requestQueue;
}
public static synchronized MySingleton getInstance(Context context) {
if(mInstance==null) {
mInstance = new MySingleton(context);
}
return mInstance;
}
public<T> void addToRequestQue(Request<T> request) {
requestQueue.add(request);
}
}
java php mysql android sqlite
java php mysql android sqlite
New contributor
New contributor
New contributor
asked 2 days ago
aria mossararia mossar
285
285
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
just to optimize the PHP part
<?php
$con->set_charset("utf8");
$sql = "select ITEMCODE, DESCRIPTION, BRAND from items where SERIAL_NO = ?";
$stmt = $con->prepare($sql);
$stmt->bind_param("s", $_POST['mySerial']);
$stmt->execute();
$data = $stmt->get_result()->fetch_all(MYSQLI_ASSOC);
echo json_encode(array("allItems"=>$data));
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "196"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
aria mossar is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f214373%2foptimize-multiple-insert-sqlite-coming-from-mysql%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
just to optimize the PHP part
<?php
$con->set_charset("utf8");
$sql = "select ITEMCODE, DESCRIPTION, BRAND from items where SERIAL_NO = ?";
$stmt = $con->prepare($sql);
$stmt->bind_param("s", $_POST['mySerial']);
$stmt->execute();
$data = $stmt->get_result()->fetch_all(MYSQLI_ASSOC);
echo json_encode(array("allItems"=>$data));
$endgroup$
add a comment |
$begingroup$
just to optimize the PHP part
<?php
$con->set_charset("utf8");
$sql = "select ITEMCODE, DESCRIPTION, BRAND from items where SERIAL_NO = ?";
$stmt = $con->prepare($sql);
$stmt->bind_param("s", $_POST['mySerial']);
$stmt->execute();
$data = $stmt->get_result()->fetch_all(MYSQLI_ASSOC);
echo json_encode(array("allItems"=>$data));
$endgroup$
add a comment |
$begingroup$
just to optimize the PHP part
<?php
$con->set_charset("utf8");
$sql = "select ITEMCODE, DESCRIPTION, BRAND from items where SERIAL_NO = ?";
$stmt = $con->prepare($sql);
$stmt->bind_param("s", $_POST['mySerial']);
$stmt->execute();
$data = $stmt->get_result()->fetch_all(MYSQLI_ASSOC);
echo json_encode(array("allItems"=>$data));
$endgroup$
just to optimize the PHP part
<?php
$con->set_charset("utf8");
$sql = "select ITEMCODE, DESCRIPTION, BRAND from items where SERIAL_NO = ?";
$stmt = $con->prepare($sql);
$stmt->bind_param("s", $_POST['mySerial']);
$stmt->execute();
$data = $stmt->get_result()->fetch_all(MYSQLI_ASSOC);
echo json_encode(array("allItems"=>$data));
edited yesterday
answered yesterday
Your Common SenseYour Common Sense
3,8111528
3,8111528
add a comment |
add a comment |
aria mossar is a new contributor. Be nice, and check out our Code of Conduct.
aria mossar is a new contributor. Be nice, and check out our Code of Conduct.
aria mossar is a new contributor. Be nice, and check out our Code of Conduct.
aria mossar is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f214373%2foptimize-multiple-insert-sqlite-coming-from-mysql%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown