00001 /******************************************************************************* 00002 ** Copyright (c) 1992-2010 VT MAK 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 00008 00009 #pragma once 00010 00011 #ifdef _WIN32 00012 #include <windows.h> 00013 #include <sqltypes.h> 00014 #else 00015 #include <sqltypes.h> 00016 #endif 00017 00018 #include "sqlIfError.h" 00019 #include "databaseCommandProcessor.h" 00020 00021 class DtString; 00022 class DtSqlConnection; 00023 00024 // Once a connection is established with a database, communication with the 00025 // database is typically done using SQL commands. An SQL statement object is 00026 // needed to execute the commands. This class creates a such a statement 00027 // object. Only once such object is needed - once created, it can used to send 00028 // any number of SQL commands. The constructor must be passed a connection 00029 // handle that is currently connected to a database. Although this class can be 00030 // set up and used directly, its usually easier to set up a 00031 // object. DtSqlIfDatabase automatically allocates a DtSqlIfStatement when it 00032 // connects to a database (using its dbConnect() method). 00033 class DT_DLL_VLDB DtSqlStatement : public DtDatabaseCommandProcessor 00034 { 00035 public: 00036 // Constructor 00037 explicit DtSqlStatement( DtSqlConnection& connection); 00038 00039 // Destructor 00040 virtual ~DtSqlStatement(); 00041 00042 // execute an SQL command 00043 virtual bool processCommand( const DtString& cmdStr ); 00044 00045 // Get the maximum allowed column width 00046 virtual unsigned int getMaximumColumnWidgth(); 00047 00048 // Accessors / Mutators 00049 00050 // returns a handle to the statement object allocated by this class 00051 SQLHSTMT handle(); 00052 00053 protected: 00054 SQLHSTMT myHandle; 00055 DtSqlIfErrorHandler myErrorHandler; 00056 };