Hello all - total noob to yii
have not a clue where to place mysql code to attempt this using Active Record
currently have written raw mysql/php report generator for static pages that
generates google visualization bar-format charts that widgets consume,
but before attempting to convert to AR was wondering are the following doable
case 1: Automation
need to run 2 similar mysql queries
results then will be consumed by widget that displays google visualization barFormat grid
i'm running this offline and cut'n'paste (8 different tables 2 queries each table ).
case 2: Forensic filters for tables with excess of 500,000 rows
while search generated by gii crud admin and extended filtering for range is somewhat helpful need real WHERE clause. User needs to supply ranges as well as NOT ranges and dates and field lengths to test after render
Hope i've explain this enough for a response, even if it is run-away and stick to straight SQL queries and forget AR/yii entirely
Sorry for long post, but could not find any post that even reference BETWEEN a and b ranges or more complex searches.
Thanks
have not a clue where to place mysql code to attempt this using Active Record
currently have written raw mysql/php report generator for static pages that
generates google visualization bar-format charts that widgets consume,
but before attempting to convert to AR was wondering are the following doable
case 1: Automation
need to run 2 similar mysql queries
/* get external inbound calls
example of output of query which is consumed by barFormat chart
google barFomat gridchart along with get outbound calls
['<==outbound - inbound==>',11,'dur','avg'],
['816 ==> Kansas City, MO',11,'00:01:39','00:00:09'],
['812 ==> Evansville, IN',2,'00:01:18','00:00:39'],
...
*/
SELECT concat("['",
case
when length(src) = 10 then left(src,3)
when length(src) = 11 then mid(src,2,3)
end,
" ==> ",
concat(t2.city, ", ",t2.st),
"',",
count(src),
",'",
SEC_TO_TIME(sum(duration)),
"','",
SEC_TO_TIME(avg(duration)),
"'],") as areacodes
FROM `cdr8`
join ac as t2
on t2.acs =
case
when length(src) = 10 then left(src,3)
when length(src) = 11 then mid(src,2,3)
end
WHERE length(src) > 9
group by
case
when length(src) = 10 then left(src,3)
when length(src) = 11 then mid(src,2,3)
end results then will be consumed by widget that displays google visualization barFormat grid
i'm running this offline and cut'n'paste (8 different tables 2 queries each table ).
case 2: Forensic filters for tables with excess of 500,000 rows
while search generated by gii crud admin and extended filtering for range is somewhat helpful need real WHERE clause. User needs to supply ranges as well as NOT ranges and dates and field lengths to test after render
WHERE field2 BETWEEN '8000' AND '8100' AND field2 REGEXP '^-?[0-9]+$' AND LENGTH(field2) = 4 AND ((LENGTH(field4) != 4 AND field4 NOT BETWEEN '8000' AND '8100') OR (field4 REGEXP '^-?[0-9]+$' AND LENGTH(field4) > 6)) AND LEFT(field0,11) between '2012-12-10' and '2012-12-13'
Hope i've explain this enough for a response, even if it is run-away and stick to straight SQL queries and forget AR/yii entirely
Sorry for long post, but could not find any post that even reference BETWEEN a and b ranges or more complex searches.
Thanks