mySQL problem with strings in table replication
Hi,
Using two tables in mySQL: table1 and table2 with same structure.
Field Type Length Key
--------------------------------------------------------
id INT 11 Primary
text1 CHAR 20
number1 INT 11
Initial situation: Content of table1, table2 is empty
Table1 table2
-------------------------- ---------------------
1 string1 100 <no records>
2 string2 200
3 string3 300
My nxlog.conf:
define ROOT C:\Program Files (x86)\nxlog
define CERT %ROOT%\cert
Moduledir %ROOT%\modules
CacheDir %ROOT%\data
Pidfile %ROOT%\data\nxlog.pid
SpoolDir %ROOT%\data
LogFile %ROOT%\data\nxlog.log
#PersistLogqueue TRUE
#SyncLogqueue TRUE
CacheFlushInterval always
CacheSync TRUE
#LogLevel DEBUG
<Input testIn>
Module im_odbc
# Pollinterval 60
ConnectionString DSN=mySQL;uid=***;pwd=***;database=nxlog
SQL SELECT id as vid ,\
text1 as vtext1 ,\
number1 as vnumber1 \
FROM table1 where id > ?
SavePos TRUE
</Input>
<Output testOut>
Module om_odbc
ConnectionString DSN=mySQL;uid=***;pwd=***;database=nxlog
<Exec>
if (sql_exec("INSERT INTO table2(text1,number1) VALUES (?,?)",$vtext1,$vnumber1)== TRUE) {};
</Exec>
</Output>
<Route 1>
Path testIn => testOut
</Route>
After I start nxlog service both tables look like this.
Table1 table2
------------------- -------------------
1 string1 100 1 string1 100
2 string2 200 2 string2 200
3 string3 300 3 string3 300
So far so good.
But when I manualy add a record to table1 both tables look like this:
Table1 table2
------------------- -------------------
1 string1 100 1 string1 100
2 string2 200 2 string2 200
3 string3 300 3 string3 300
4 string4 400 4 string3 400
As you can see in table2: the string has the value of record3. Number is OK.
When I keep adding records to table1 it keeps on taking the string of record 3 but number is correct.
After restart of nxlog service and manualy adding a record to table1 I get this:
Table1 table2
------------------- -------------------
1 string1 100 1 string1 100
2 string2 200 2 string2 200
3 string3 300 3 string3 300
4 string4 400 4 string3 400
5 string5 500 5 <empty> 500
table2 string has no value and number is correct.
Any ideas someone?
Wout