Lalit Bhasin
2013-08-05 07:02:10 UTC
Hi,
While trying to generate an continuous sequence values for non-auto_increment column in mysql, the soci is failing with exception "Column count doesn't match value count", but same sql statements work fine from mysql command prompt.
Here is the small test code to reproduce the error:
---clip--
#include <soci/soci.h>
#include <soci/mysql/soci-mysql.h>
main() {
soci::session sql("mysql","service=dbrepl user=scott password=tiger" );
sql << " CREATE TABLE a ( a_c1 int, a_c2 int)";
sql << "CREATE TABLE b (b_c1 int)";
sql << " INSERT INTO b values (10)";
sql << " INSERT INTO b values (20)";
sql << " INSERT INTO b values (30)";
sql << " SELECT @row := 0";
sql << " INSERT INTO a(a_c1,a_c2) SELECT @row := @row+1 as a_c1, b_c1 as a_c2 from b ";
}
---clap--
On running this, I get error as below:
---
[***@SRadiusDEV tmp]$ ./a.out
terminate called after throwing an instance of 'soci::mysql_soci_error'
what(): Column count doesn't match value count at row 1
While trying to generate an continuous sequence values for non-auto_increment column in mysql, the soci is failing with exception "Column count doesn't match value count", but same sql statements work fine from mysql command prompt.
Here is the small test code to reproduce the error:
---clip--
#include <soci/soci.h>
#include <soci/mysql/soci-mysql.h>
main() {
soci::session sql("mysql","service=dbrepl user=scott password=tiger" );
sql << " CREATE TABLE a ( a_c1 int, a_c2 int)";
sql << "CREATE TABLE b (b_c1 int)";
sql << " INSERT INTO b values (10)";
sql << " INSERT INTO b values (20)";
sql << " INSERT INTO b values (30)";
sql << " SELECT @row := 0";
sql << " INSERT INTO a(a_c1,a_c2) SELECT @row := @row+1 as a_c1, b_c1 as a_c2 from b ";
}
---clap--
On running this, I get error as below:
---
[***@SRadiusDEV tmp]$ ./a.out
terminate called after throwing an instance of 'soci::mysql_soci_error'
what(): Column count doesn't match value count at row 1