home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / progs / CB / DATA.Z / UPDSQLED.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-06  |  6.5 KB  |  186 lines

  1. //----------------------------------------------------------------------------
  2. // UpdSqlEd.hpp - dcc32 generated hdr (DO NOT EDIT) rev: -2
  3. // From: UpdSqlEd.pas
  4. //----------------------------------------------------------------------------
  5. #ifndef UpdSqlEdHPP
  6. #define UpdSqlEdHPP
  7. //----------------------------------------------------------------------------
  8. #ifndef MenusHPP
  9. #include <Menus.hpp>
  10. #endif
  11.  
  12. #ifndef WindowsHPP
  13. #include <Windows.hpp>
  14. #endif
  15.  
  16. #ifndef SysUtilsHPP
  17. #include <SysUtils.hpp>
  18. #endif
  19.  
  20. #ifndef ClassesHPP
  21. #include <Classes.hpp>
  22. #endif
  23.  
  24. #ifndef ComCtrlsHPP
  25. #include <ComCtrls.hpp>
  26. #endif
  27.  
  28. #ifndef ControlsHPP
  29. #include <Controls.hpp>
  30. #endif
  31.  
  32. #ifndef StdCtrlsHPP
  33. #include <StdCtrls.hpp>
  34. #endif
  35.  
  36. #ifndef ExtCtrlsHPP
  37. #include <ExtCtrls.hpp>
  38. #endif
  39.  
  40. #ifndef DBTablesHPP
  41. #include <DBTables.hpp>
  42. #endif
  43.  
  44. #ifndef DBHPP
  45. #include <DB.hpp>
  46. #endif
  47.  
  48. #ifndef FormsHPP
  49. #include <Forms.hpp>
  50. #endif
  51.  
  52. #ifndef SystemHPP
  53. #include <System.hpp>
  54. #endif
  55.  
  56. namespace Updsqled
  57. {
  58. //-- type declarations -------------------------------------------------------
  59. typedef void __fastcall (__closure *TWaitMethod)(void);
  60.  
  61. class __declspec(delphiclass) TUpdateSQLEditForm;
  62. class __declspec(pascalimplementation) TUpdateSQLEditForm : public Forms::TForm
  63. {
  64.     typedef TUpdateSQLEditForm ThisClass;
  65.     typedef Forms::TForm inherited;
  66.     
  67. __published:
  68.     Stdctrls::TButton *OkButton;
  69.     Stdctrls::TButton *CancelButton;
  70.     Stdctrls::TButton *HelpButton;
  71.     Stdctrls::TButton *GenerateButton;
  72.     Stdctrls::TButton *PrimaryKeyButton;
  73.     Stdctrls::TButton *DefaultButton;
  74.     Stdctrls::TComboBox *UpdateTableName;
  75.     Comctrls::TTabSheet *FieldsPage;
  76.     Comctrls::TTabSheet *SQLPage;
  77.     Comctrls::TPageControl *PageControl;
  78.     Stdctrls::TListBox *KeyFieldList;
  79.     Stdctrls::TListBox *UpdateFieldList;
  80.     Stdctrls::TGroupBox *GroupBox1;
  81.     Stdctrls::TLabel *Label1;
  82.     Stdctrls::TMemo *SQLMemo;
  83.     Dbtables::TTable *TempTable;
  84.     Extctrls::TRadioGroup *StatementType;
  85.     Stdctrls::TCheckBox *QuoteFields;
  86.     Stdctrls::TButton *GetTableFieldsButton;
  87.     Menus::TPopupMenu *FieldListPopup;
  88.     Menus::TMenuItem *miSelectAll;
  89.     Menus::TMenuItem *miClearAll;
  90.     void __fastcall FormCreate(System::TObject *Sender);
  91.     void __fastcall HelpButtonClick(System::TObject *Sender);
  92.     void __fastcall StatementTypeClick(System::TObject *Sender);
  93.     void __fastcall OkButtonClick(System::TObject *Sender);
  94.     void __fastcall DefaultButtonClick(System::TObject *Sender);
  95.     void __fastcall GenerateButtonClick(System::TObject *Sender);
  96.     void __fastcall PrimaryKeyButtonClick(System::TObject *Sender);
  97.     void __fastcall PageControlChanging(System::TObject *Sender, System::Boolean &AllowChange);
  98.     void __fastcall FormDestroy(System::TObject *Sender);
  99.     void __fastcall GetTableFieldsButtonClick(System::TObject *Sender);
  100.     void __fastcall SettingsChanged(System::TObject *Sender);
  101.     void __fastcall FormCloseQuery(System::TObject *Sender, System::Boolean &CanClose);
  102.     void __fastcall UpdateTableNameChange(System::TObject *Sender);
  103.     void __fastcall UpdateTableNameClick(System::TObject *Sender);
  104.     void __fastcall SelectAllClick(System::TObject *Sender);
  105.     void __fastcall ClearAllClick(System::TObject *Sender);
  106.     void __fastcall SQLMemoKeyPress(System::TObject *Sender, System::Char &Key);
  107.     
  108. private:
  109.     System::Integer StmtIndex;
  110.     Db::TDBDataSet *DataSet;
  111.     Db::TDatabase *Database;
  112.     System::Boolean DatabaseOpened;
  113.     Dbtables::TUpdateSQL *UpdateSQL;
  114.     System::Boolean FSettingsChanged;
  115.     System::Boolean FDatasetDefaults;
  116.     Classes::TStrings *SQLText[3];
  117.     void __fastcall CheckFieldTypes(Classes::TStrings *UpdateFieldList);
  118.     System::AnsiString __fastcall GetTableRef(const System::AnsiString TabName, const System::AnsiString 
  119.         QuoteChar);
  120.     System::Boolean __fastcall DatabaseOpen(void);
  121.     System::Boolean __fastcall Edit(void);
  122.     void __fastcall GenWhereClause(const System::AnsiString TabAlias, const System::AnsiString QuoteChar
  123.         , Classes::TStrings *KeyFields, Classes::TStrings *SQL);
  124.     void __fastcall GenDeleteSQL(const System::AnsiString TableName, const System::AnsiString QuoteChar
  125.         , Classes::TStrings *KeyFields, Classes::TStrings *SQL);
  126.     void __fastcall GenInsertSQL(const System::AnsiString TableName, const System::AnsiString QuoteChar
  127.         , Classes::TStrings *UpdateFields, Classes::TStrings *SQL);
  128.     void __fastcall GenModifySQL(const System::AnsiString TableName, const System::AnsiString QuoteChar
  129.         , Classes::TStrings *KeyFields, Classes::TStrings *UpdateFields, Classes::TStrings *SQL);
  130.     void __fastcall GenerateSQL(void);
  131.     void __fastcall GetDataSetFieldNames(void);
  132.     void __fastcall GetTableFieldNames(void);
  133.     void __fastcall InitGenerateOptions(void);
  134.     void __fastcall InitUpdateTableNames(void);
  135.     void __fastcall SetButtonStates(void);
  136.     void __fastcall SelectPrimaryKeyFields(void);
  137.     void __fastcall SetDefaultSelections(void);
  138.     void __fastcall ShowWait(TWaitMethod WaitMethod);
  139. public:
  140.     /* !! TForm.Create */ __fastcall virtual TUpdateSQLEditForm(Classes::TComponent *AOwner) : Forms::TForm(
  141.         AOwner) { }
  142.     /* !! TForm.CreateNew */ __fastcall TUpdateSQLEditForm(Classes::TComponent *AOwner, System::Integer 
  143.         Dummy) : Forms::TForm(AOwner, Dummy) { }
  144.     /* !! TForm.Destroy */ __fastcall virtual ~TUpdateSQLEditForm(void) { }
  145.     
  146. };
  147.  
  148. enum TSQLToken { stSymbol, stAlias, stNumber, stComma, stEQ, stOther, stLParen, stRParen, stEnd };
  149.  
  150. class __declspec(delphiclass) TSQLParser;
  151. class __declspec(pascalimplementation) TSQLParser : public System::TObject
  152. {
  153.     typedef TSQLParser ThisClass;
  154.     typedef System::TObject inherited;
  155.     
  156. private:
  157.     System::AnsiString FText;
  158.     System::Char *FSourcePtr;
  159.     System::Char *FTokenPtr;
  160.     System::AnsiString FTokenString;
  161.     TSQLToken FToken;
  162.     TSQLToken __fastcall NextToken(void);
  163.     System::Boolean __fastcall TokenSymbolIs(const System::AnsiString S);
  164.     void __fastcall Reset(void);
  165.     
  166. public:
  167.     __fastcall TSQLParser(const System::AnsiString Text);
  168.     void __fastcall GetSelectTableNames(Classes::TStrings *List);
  169.     void __fastcall GetUpdateTableName( System::AnsiString &TableName);
  170.     void __fastcall GetUpdateFields(Classes::TStrings *List);
  171.     void __fastcall GetWhereFields(Classes::TStrings *List);
  172. public:
  173.     /* !! TObject.Destroy */ __fastcall virtual ~TSQLParser(void) { }
  174.     
  175. };
  176.  
  177. //-- var, const, procedure ---------------------------------------------------
  178. extern System::Boolean __fastcall EditUpdateSQL(Dbtables::TUpdateSQL *AUpdateSQL);
  179.  
  180. }    /* namespace Updsqled */
  181. #if !defined(NO_IMPLICIT_NAMESPACE_USE)
  182. using namespace Updsqled;
  183. #endif
  184. //-- end unit ----------------------------------------------------------------
  185. #endif    // UpdSqlEd
  186.