diff options
Diffstat (limited to 'src/sql/xbcrtbl.cpp')
-rwxr-xr-x | src/sql/xbcrtbl.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/sql/xbcrtbl.cpp b/src/sql/xbcrtbl.cpp index dfb3403..e22b0b5 100755 --- a/src/sql/xbcrtbl.cpp +++ b/src/sql/xbcrtbl.cpp @@ -69,8 +69,8 @@ xbInt16 xbSql::SqlCreateTable( const xbString &sCmdLine ){ sTableName.ExtractElement( s, ' ', 3, 0 ); sTableName.Trim(); - // std::cout << "Tablename = [" << sTableName << "]\n"; - +// std::cout << "Create table - Tablename = [" << sTableName.Str() << "]\n"; +// std::cout << "Cm line = [" << sCmdLine.Str() << "]\n"; // determine if it already exists xbFile f( xbase ); @@ -160,17 +160,21 @@ xbInt16 xbSql::SqlCreateTable( const xbString &sCmdLine ){ if( iAttribCnt == 1 ){ sAttrib1 = sWork; } else { + lCmPos = sWork.Pos( ',' ); if( lCmPos <= 0 ){ iErrorStop = 140; iRc = XB_INVALID_FIELD_LEN; throw iRc; } + sAttrib1.Assign( sWork, 1, lCmPos - 1); sAttrib1.Trim(); + sWork.Ltrunc( lCmPos ); sAttrib2 = sWork; sAttrib2.Trim(); + } s.Ltrunc( lPos ); } @@ -239,13 +243,15 @@ xbInt16 xbSql::SqlCreateTable( const xbString &sCmdLine ){ #elif defined (XB_DBF3_SUPPORT) dbf = new xbDbf3( xbase ); #endif + if(( iRc = dbf->CreateTable( sTableName, "", schema, 0, XB_MULTI_USER )) != XB_NO_ERROR ){ iErrorStop = 150; throw iRc; } - free( schema ); + ll.Clear(); + } catch (xbInt16 iRc ){ xbString sMsg; @@ -258,6 +264,7 @@ xbInt16 xbSql::SqlCreateTable( const xbString &sCmdLine ){ xbase->WriteLogMessage( GetErrorMessage( iRc )); if( schema ) free( schema ); } + return iRc; } |