spencerlambert / mysql-events

A node meteor package that watches a MySQL database and runs callbacks on matched events.
Other
87 stars 74 forks source link

Events are not triggering if the database having period symbol (.) #42

Closed jmhemadri closed 6 years ago

jmhemadri commented 6 years ago

HI All,

I am having database name called "employee.qa" and when I used table like below to monitor and it is not trigger.

var category_table = 'employee.qa.tablename'; var category = mysqlEventWatcher.add( category_table, function (oldRow, newRow, event) { console.log("Category Event Watcher Called ");



But the above code working fine if i use database employee_qa. Can you please let me know is there any work around with period symbol. I tried below ways var category_table = 'employee.qa.tablename'; var category_table = '[employee.qa].tablename'; var category_table = ''employee.qa'.tablename'; var category_table = '\'employee.qa\'.tablename';

Thanks in advance

a-k-macdonald commented 6 years ago

I don't know if you can but did you try `employee`.`tablename`

I'm not sure it will help but it might.

spencerlambert commented 6 years ago

It's the dot within the database name that isn't compatible with this code. Dots are used as delimiters between database, table, column, and regex. The parsing code would have to change.

I think using a dot within a database name is kinda confusing anyway, as a dot between a database and table is standard MySQL syntax. So it's kinda hard to quickly understand what "employee.qa" means, is it a database or is it a database and table.

jmhemadri commented 6 years ago

Understood. It there any workaround like if we pass database with in brackets like [employee.qa]?

spencerlambert commented 6 years ago

In looking at my code more (sorry it's been a while sense I wrote this), I see that it doesn't actually parse the watch on var. It joins is to match on a watch on, so this dot thing is coming from something else, like may be ZongJi.

Maybe ZongJi is converting your . to an _. I guess use emplyoee_qa and be happy.

jmhemadri commented 6 years ago

Okay Thank you so much will change my database.