Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

dbexport.h

00001 /* liblookdb: dbexport.h - Database export to flat file 
00002     Copyright (C) 1998-2001 LOOK Systems
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Lesser General Public
00006     License as published by the Free Software Foundation; either
00007     version 2.1 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Lesser General Public License for more details.
00013 
00014     You should have received a copy of the GNU Lesser General Public
00015     License along with this library; if not, write to the Free Software
00016     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 */
00018 #ifndef LIBLOOKDB_DBEXPORT_H
00019 #define LIBLOOKDB_DBEXPORT_H
00020 
00021 // $Id: dbexport.h,v 1.8 2001/07/05 16:25:22 clive Exp $
00022 
00023 #include "lookdblibrary.h"
00024 #include "dbdescribetable.h"
00025 #include "lookstringlist.h"
00026 
00027 namespace look {
00028 
00029 class DbField;
00030 
00032 
00053 class LOOKDBUTILITIES_DLL DbExport
00054 {
00055 public:
00056 
00058 
00064         enum SuppressionMode
00065         {
00066                 SUPPRESS_NONE = 0, 
00067                 SUPPRESS_TABLENAME = 1, 
00068                 SUPPRESS_COLUMNNAMES = 2 
00069         };
00070 
00071         // this determines what happens with text with control chars in.
00072         // no_convert does nothing (preserves tab, etc)
00073         // convert_normal converts tab to \t, cr to \r, lf to \\n, \ to \\
00074         // qe wraps the entire string in "" (and doubles internal "
00075         // chars too) suitable for pasting into q&e
00077 
00080         enum TextConversionMode
00081         {
00082                 NO_CONVERT = 0, 
00083                 CONVERT_NORMAL, 
00084                 CONVERT_TO_QE   
00085         };
00086 
00087         DbExport( const LookString& theTableName );
00088 
00089         ~DbExport();
00090 
00091         void AddOtherTable( const LookString& theTableName );
00092         void SetWhereClause( const LookString& theWhereClause );
00093         void SetOrderClause( const LookString& theOrderClause );
00094         void SetFloatPrecision( int thePrecision );
00095 
00097         void SetSuppressionMode( int theSuppressionMode )
00098         {
00099                 itsHeaderSuppressionMode = theSuppressionMode;
00100         }
00101         
00103         void SetNULLString( const LookString& theString )
00104         {
00105                 itsNULLString = theString;
00106         }
00107 
00109         void SetTextConversionMode( TextConversionMode theConversionMode )
00110         {
00111                 itsTextConversionMode = theConversionMode;
00112         }
00113 
00118         void SetDOSLineEnds( bool useCRLF )
00119         {
00120                 if( useCRLF )
00121                 {
00122                         itsLFString = "\r\n";
00123                 }
00124                 else
00125                 {
00126                         itsLFString = "\n";
00127                 }
00128         }
00129 
00130         bool DoExport( const LookString& theFileName );
00131 
00132         long GetNRowsExported( void );
00133 
00134 protected:
00135 
00136         LookString GenerateSelectString( void );
00137 
00138         LookString GetExportString( const DbField* theField );
00139 
00140         LookString itsTableName;
00141         LookStringList itsOtherTables;
00142         LookString itsWhereClause;
00143         LookString itsOrderClause;
00144 
00145         int itsFloatPrecision;
00146         bool itHasFloatPrecision;
00147         int itsHeaderSuppressionMode;
00148         TextConversionMode itsTextConversionMode;
00149         
00150         LookString itsNULLString;
00151         LookString itsLFString;
00152         
00153         DbDescribeTable::ColumnInfoList itsTableColumns;
00154 
00155         long itsNRowsExported;
00156 };
00157 
00158 
00159 } // end of "look" namespace
00160 #endif

Generated at Thu Jan 17 12:53:06 2002 for liblookdb by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001