I'm developing an Android app that communicates with an Rest API (Codeigniter). I'm trying to query into my SQLite database and create an array on format that Codeigniter requires. The insert_batch method requires something like this:
Here is my code so far:
Cursor c = db.query(MY_QUERY);
c.moveToFirst();
while(c.isAfterLast()==false)
{
// TODO: here I have to insert the keys->values into an array of arrays
}
// Here I have to return this array;
return dataArray;
My Codeigniter's Rest API code (Controller):
public function myController_post()
{
$dados = $this->post('dataArray');
if($this->myModel->insertMyData($dataArray)) {
return true;
}
return false;
}
And my model:
function insertMyData($data) {
return $this->db->insert_batch('my_table', $data);
}
The question is: how to create this array of arrays from my cursor?
Aucun commentaire:
Enregistrer un commentaire