0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 09:06:21 +01:00

fix for csv import where last field has " SERVER-682

This commit is contained in:
Eliot Horowitz 2010-02-27 23:05:40 -05:00
parent b32a47826e
commit 00ca5d90fe

View File

@ -201,7 +201,7 @@ public:
log(1) << "filesize: " << fileSize << endl; log(1) << "filesize: " << fileSize << endl;
ProgressMeter pm( fileSize ); ProgressMeter pm( fileSize );
const int BUF_SIZE = 1024 * 1024 * 4; const int BUF_SIZE = 1024 * 1024 * 4;
boost::scoped_array<char> line(new char[BUF_SIZE]); boost::scoped_array<char> line(new char[BUF_SIZE+2]);
while ( *in ){ while ( *in ){
char * buf = line.get(); char * buf = line.get();
in->getline( buf , BUF_SIZE ); in->getline( buf , BUF_SIZE );
@ -214,6 +214,8 @@ public:
if ( ! len ) if ( ! len )
continue; continue;
buf[len+1] = 0;
if ( in->rdstate() == ios_base::eofbit ) if ( in->rdstate() == ios_base::eofbit )
break; break;
assert( in->rdstate() == 0 ); assert( in->rdstate() == 0 );