I am fetching some data from the database as below in my ruby file:
@main1= $connection.execute("SELECT * FROM builds
WHERE platform_type LIKE 'TOTAL';")
@main2= $connection.execute("SELECT * FROM builds
WHERE platform_type NOT LIKE 'TOTAL';")
After doing this I am performing hashing and a bunch of other stuff on these results. To be clear, this does not return an array as such, but it returns some mysql2 type object. So I just map it to 2 arrays to be safe:
@arr1 = Array.new
@arr1 = @main1.map
@arr2 = Array.new
@arr2 = @main2.map
Is there any way to avoid executing 2 different queries and getting all the results in 2 different arrays by executing just one query. I basically want to split the results into 2 arrays, the first one having platform_type = TOTAL and everything else in the other one.