Skip to Content.
Sympa Menu

freetds - Multiples inserts using DB-Lib/MSSQL 7.

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Vanderlei Silva" <vandersilva AT hotmail.com>
  • To: freetds
  • Subject: Multiples inserts using DB-Lib/MSSQL 7.
  • Date: Wed, 1 Dec 1999 19:40:13


Hello,
I'm trying to write a migration app in order to transfer our data from
mySql to MSSQL 7. Using DB-Lib via freeTDS.
The following code generates, apparently, good logs in /tmp/freetds.log
but the true is that only 1 or two rows are really affected in the server.

dbinit();
login = dblogin();
DBSETLPWD(login,"xxx");
DBSETLUSER(login,"xxx");
DBSETLAPP(login,"sqsh");
DBSETLHOST(login,"x.x.x.x");
dbproc = dbopen(login, "IMSSQL");
dbuse(dbproc, "REGISTRATION");
.
.
.
while((qrow = mysql_fetch_row(qresult))) {
if (qrow[0] != NULL) data.memory = atol(qrow[0]);
if (qrow[1] != NULL) strcpy(data.platform, qrow[1]);
sprintf(final_sql_cmd, sql_cmd, data.memory, data.platform);
dbcmd(dbproc, final_sql_cmd);
dbsqlexec(dbproc);
}
.
.
.

I noticed that if I stop the loop after the first 2 insertions, these 2
rows are successfully stored in the server. So, I put the a counter and the
following code after the dbsqlexec:
if ( (i % 2) == 0) {
sleep(1);
}
And, it started working fine. But, as you can see, for a big database this
approach is unacceptable. Any clue???


Thanks guys,
Vanderlei Silva,









Archive powered by MHonArc 2.6.24.

Top of Page