g613 / asterisk-cdr-viewer

Simple and fast viewer for asterisk CDRs / recordings
54 stars 33 forks source link

Postgresql #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi.
Do you plan to support Postgresql, not only mysql cdr?

Original issue reported on code.google.com by rastaro...@gmail.com on 28 Jun 2012 at 2:13

GoogleCodeExporter commented 9 years ago
I added it to my ToDo list.

Original comment by igor.oku...@gmail.com on 29 Jun 2012 at 11:47

GoogleCodeExporter commented 9 years ago
migrated to PDO interface.

Original comment by igor.oku...@gmail.com on 26 Jul 2012 at 6:43

GoogleCodeExporter commented 9 years ago
hi, i tested postgers compability and got following errors:

1.
PDO::errorInfo(): Array ( [0] => 3F000 [1] => 7 [2] => ERROR: schema "asterisk" 
does not exist LINE 1: SELECT count(*) FROM asterisk.cdr WHERE calldate BETWEEN 
'20... ^ ) 

asterisk is db_name.
working for me after changing request 
from

 FROM $db_name.$db_table_name

to  

 FROM $db_table_name

in index.php

2. 
PDO::errorInfo(): Array ( [0] => 42883 [1] => 7 [2] => ERROR: function 
unix_timestamp(timestamp with time zone) does not exist LINE 1: ...tion, 
amaflags, accountcode, uniqueid, userfield, unix_times... ^ HINT: No function 
matches the given name and argument types. You might need to add explicit type 
casts. ) 

working for me after changing 
from 

unix_timestamp(calldate)

to

EXTRACT(EPOCH FROM calldate)

, thanks for your job

Original comment by rastaro...@gmail.com on 7 Aug 2012 at 12:26

GoogleCodeExporter commented 9 years ago
+ for CallGraph

3. DATE_FORMAT(calldate, '%Y-%m-%d') change to to_char(calldate, 'YY-mm-dd')
and other construction '%Y-%m-%d' to 'YY-mm-dd'
(%H to HH %i to MI and so on)

4. for emulate concat function in PostgreSQL use this hint

CREATE FUNCTION concat(VARIADIC arr anyarray) RETURNS text AS $$
    SELECT array_to_string($1, '');
$$ LANGUAGE SQL;

http://www.postgresql.org/message-id/AANLkTikH1_QDW73aBGNbB0rAG3M53GhNHQPTfJtPtC
o6@mail.gmail.com

5. Concuret call in SELECT (query3)
"interval duration second" to "duration * interval '1 second'"

6. and add ",duration" to construction " GROUP BY group_by_field, EXTRACT(EPOCH 
FROM calldate)"

with this additional patch i have been got 100% working system.

Original comment by m.sm...@gmail.com on 18 Jun 2013 at 12:29