00001 /* 00002 Handy query viewer 00003 */ 00004 #ifndef Query_Result_List_Hpp 00005 #define Query_Result_List_Hpp 00006 00007 #include "Composite_Query.hpp" 00008 00009 class Query_Result_List: public list_base 00010 { 00011 public: 00012 ocString Query_Id; 00013 00014 int fieldCount; 00015 // Constructor 00016 Query_Result_List(cgiScript&sc, Session_Obj & session):list_base(sc,session){;} 00017 ~Query_Result_List(){;} 00018 00019 bool list_display( void ) 00020 { 00021 bool breturn = true; 00022 hotCol=-1; // no heat 00023 string sql; 00024 00025 Composite_Query_Obj qry; 00026 00027 qry.key(atoll(Query_Id.c_str())); 00028 if( qry.get_data() ) 00029 { 00030 00031 sql = qry.asSQL(false); 00032 00033 if( sql.find("limit") == string::npos ) 00034 sql += " limit 2 "; 00035 getData( sql ); 00036 emitHeadings(); 00037 emitData(); 00038 } 00039 else 00040 { 00041 webIO << "No data in Query - Key: " << Query_Id << endl; 00042 } 00043 00044 00045 emitEnd(); 00046 return breturn; 00047 } 00048 void emitHeadings( void ) 00049 { 00050 ocString heading; 00051 fieldCount = rs.getFieldCount(); 00052 for( int i=0; i<fieldCount; i++ ) 00053 { 00054 heading.append(i); 00055 heading += "<br>"; 00056 heading += rs.getField(i).getName(); 00057 heading += "|"; 00058 } 00059 list_base::emitHeadings(heading); 00060 } 00061 }; 00062 #endif
1.5.5