B4J Question Inserting to mysql via job.download -multiple items

tufanv

Expert
Licensed User
Longtime User
Hello,

I am using httpjob.download to get some data from a network as json, and want to send to my mysql. There are about 70 entries when i get them from the remote network and about 6 columns for each row, I use json parser to get all of them.

I use get method again to send data to my php like:
B4X:
 yolla.download2("https://..", Array As String ("action", "altingirtarihsel", "1",altin1, "2", altin2...))

and in my php i use stg like:

B4X:
$altin1 = $_GET["1"];
 $altin2 = $_GET["2"];

then insert them qith mysql_query


now coming to my question,
when i get the 70 entries as json from another network, this is 1 of them :
B4X:
[{"dailyChangePercentage":-0.7168,"dailyChange":-0.0259,"c":"USDPAK","last":3.59425,"ask":3.5949,"bid":3.5936},

there are 69 more symbols like USDPAK in this exampel and all have different values.

it is impoosible to use a code like this in this situation:

B4X:
 yolla.download2("https://..", Array As String ("action", "altingirtarihsel", "1",altin1, "2", altin2...))

because there will be around 70x6 entries if i choose to send them one by one.

Also i cant use in my non-ui application:

B4X:
For i=0 To l.Size-1
 m=l.get(i)
symbol(i) = m.get("c")
last(i) = m.get("last")
.
.
.
.
yolla.download2("https://..", Array As String ("action", "altingirtarihsel", "sembol",symbol)i), "last", last(i)...))
          
               
Next

because it will use different 70 get method and all of them will run 1 query each that will make 70 different sql queries.

I know I explained very complicated but is there any way to for example store those 70 entries in lists and send them with httpjobs to my php with only 1 get and make 1 query in php ?

Thanks
 

keirS

Well-Known Member
Licensed User
Longtime User
If understand what you are saying correctly then if you have full control over your MySQL server then you can either build a CSV file or an XML file and send that to your PHP. You then call LOAD DATA INFILE or LOAD XML to update you MySQL server.
 
Upvote 0

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
for what i understand, you can use the library json parser / generator to store the arrays in a list (lists within a list) and make the list a json text.
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
I solved the problem with sending the whole json response to php and parse within the php . Thanks for help!
 
Upvote 0
Top