00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <iostream>
00013 #include <iomanip>
00014 #include "cgiTemplates.h"
00015 #include "connectstring"
00016 #include "forms.h"
00017 #include "ocTypes.h"
00018 #include "ocString.h"
00019 #include "read_write_base.hpp"
00020 #include "forms_base.hpp"
00021 #include "cgiTemplates.h"
00022 #include "Composite_Query.hpp"
00023 #include "openLogin.h"
00024
00025 using namespace std;
00026 openLogin oLogin;
00027
00028 #include "InfoPoints.hpp"
00029
00030 class Composite_Query_form: public Composite_Query_Obj, public forms_base
00031 {
00032 public:
00033 Composite_Query_form(cgiScript & script):Composite_Query_Obj(),forms_base(script)
00034 {
00035 setKey(*this);
00036 }
00037 virtual ~Composite_Query_form(){;}
00038
00039 void form_id_transfer( void )
00040 {
00041 llongFXfer( "Id", Id );
00042 }
00043 void form_data_transfer( void )
00044 {
00045 }
00046
00047
00048 bool dbf_action( string mode, changeMap & changes )
00049 {
00050 if( mode == "s" )
00051 {
00052 return db_action( mode, changes );
00053 }
00054 return false;
00055 }
00056
00057
00058 bool form_display( void )
00059 {
00060 bool breturn = true;
00061
00062 string result;
00063 script << ocString(makeTop("Composite_Query_Popup.cgi", "Query Test")).replace("doExit()","window.close()");
00064 script << "These results are valid only for an updated composite query. Be sure to hit update or insert before calling test. " << endl;
00065
00066
00067 if( Id )
00068 {
00069 ocString sql = asSQL(false);
00070 script << makeTextArea( "Query", "sql", sql, "8", "80" );
00071 if( rs.open(sql) )
00072 {
00073 int i;
00074 int count = 0;
00075 for( i=0; i<rs.getFieldCount();i++)
00076 {
00077 result += rs.getField(i).getName() + "\t";
00078 }
00079 result += "\n===============================================\n";
00080 do{
00081 count++;
00082 for( i=0; i<rs.getFieldCount();i++)
00083 {
00084 result += rs.getField(i).format() + "\t";
00085 }
00086 result += "\n-----------------------------------------------\n";
00087 result += db.errorString();
00088
00089 } while( rs.isOpen() && rs.next() && count < 10 );
00090 rs.close();
00091 }
00092 else
00093 {
00094 result += "QUERY FAILED:\n";
00095 result += db.errorString();
00096 }
00097 script << makeTextArea( "Result", "result", result, "8", "80" );
00098 }
00099 script << makeBottom( m_result ) << endl;
00100 return breturn;
00101 }
00102 };
00103
00104
00105 int main( int argcount, char ** args )
00106 {
00107 cgiScript script( "text/html", false );
00108 Composite_Query_form myFrm(script);
00109
00110 infoPoints iPoints;
00111 if( iPoints.idToken.length() )
00112 {
00113 oLogin.token = iPoints.idToken;
00114 }
00115
00116 if( oLogin.testLoginStatus() )
00117 {
00118 script.closeHeader();
00119 cgiTemplates pgTemplate;
00120 pgTemplate.load("Templates/childPane.htmp");
00121
00122 script << ocString(pgTemplate.getParagraph("top"))
00123 .replaceAll("$heading$","Composite_Query");
00124
00125 myFrm.loadControlTemplates("Templates/childdivform.htmp");
00126 myFrm.form_action();
00127 myFrm.form_display();
00128
00129 ocString end = pgTemplate.getParagraph("bottom");
00130 script << end;
00131 }
00132 else
00133 {
00134 script.Redirect("/");
00135 }
00136 }
00137
00138 #include "read_write_base.cpp"
00139 #include "forms_base.cpp"
00140