[sr-dev] definition of mohqcalls table

Daniel-Constantin Mierla miconda at gmail.com
Tue Oct 29 22:21:36 CET 2013


Hello,

while trying to create mohqcalls it gives an error:

ERROR 1064 (42000) at line 2: You have an error in your SQL syntax; 
check the manual that corresponds to your MySQL server version for the 
right syntax to use near 'yyyy-mm-dd hh24:mi:ss')' NOT NULL,
     CONSTRAINT mohqcalls_idx UNIQUE (call_id)' at line 8
ERROR: Creating extra tables failed at mohqueue!

The sqlscript is:

CREATE TABLE mohqcalls (
     id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
     mohq_id INT(10) UNSIGNED NOT NULL,
     call_id VARCHAR(100) NOT NULL,
     call_status INT UNSIGNED NOT NULL,
     call_from VARCHAR(100) NOT NULL,
     call_contact VARCHAR(100),
     call_time DATETIME DEFAULT 'to_date('','yyyy-mm-dd hh24:mi:ss')' 
NOT NULL,
     CONSTRAINT mohqcalls_idx UNIQUE (call_id)
);

The problem is that the only very recent mysql versions support 
functions as default value. Another rather strange for my eye is the 
hh24 specifier for the hour, but that can be valid, I haven't checked 
the manual as I didn't get that far.

Is the code relying on mysql populating the value with current date? If 
yes, it should be changed so that the value is given from the c code -- 
it is not a big coding effort and it will make it compatible with most 
of stable OS distributions out there. The the column definition can be 
just to constrain not to be a null value.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Trainings - Berlin, Nov 25-28
   - more details about Kamailio trainings at http://www.asipto.com -




More information about the sr-dev mailing list