Browse Source

HPCC-9238 Use a record of string<n> to display fixed length datasets

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 12 năm trước cách đây
mục cha
commit
9104c79c78

+ 1 - 1
common/fileview2/fverror.hpp

@@ -55,7 +55,7 @@
 #define FVERR_RowTooLarge                       2029
 #define FVERR_RowTooLarge                       2029
 
 
 #define FVERR_CouldNotResolveX_Text             "Could not resolve file '%s' in DFS"
 #define FVERR_CouldNotResolveX_Text             "Could not resolve file '%s' in DFS"
-#define FVERR_NoRecordDescription_Text          "DFS did not contain record description for '%s'"
+#define FVERR_NoRecordDescription_Text          "DFS did not contain a record description for '%s'"
 #define FVERR_BadRecordDesc_Text                "Could not process record description for '%s'"
 #define FVERR_BadRecordDesc_Text                "Could not process record description for '%s'"
 #define FVERR_NeedClusterToBrowseX_Text         "Need queue/cluster to browse file '%s'"
 #define FVERR_NeedClusterToBrowseX_Text         "Need queue/cluster to browse file '%s'"
 #define FVERR_TimeoutRemoteFileView_Text        "Connection to file view server timed out"
 #define FVERR_TimeoutRemoteFileView_Text        "Connection to file view server timed out"

+ 19 - 5
common/fileview2/fvresultset.cpp

@@ -116,12 +116,26 @@ IFvDataSource * createFileDataSource(IDistributedFile * df, const char * logical
         return NULL;
         return NULL;
     }
     }
     const char * recordEcl = properties.queryProp("ECL");
     const char * recordEcl = properties.queryProp("ECL");
-    if (!recordEcl)
-        throwError1(FVERR_NoRecordDescription, logicalName);
+    OwnedHqlExpr diskRecord;
+    if (recordEcl)
+    {
+        diskRecord.setown(parseQuery(recordEcl));
+
+        if (!diskRecord)
+            throwError1(FVERR_BadRecordDesc, logicalName);
+    }
+    else
+    {
+        size32_t len = (size32_t)properties.getPropInt("@recordSize", 0);
+        if (len)
+        {
+            VStringBuffer recordText("{ string%u contents };", len);
+            diskRecord.setown(parseQuery(recordText));
+        }
 
 
-    OwnedHqlExpr diskRecord = parseQuery(recordEcl);
-    if (!diskRecord)
-        throwError1(FVERR_BadRecordDesc, logicalName);
+        if (!diskRecord)
+            throwError1(FVERR_NoRecordDescription, logicalName);
+    }
 
 
     Owned<ADataSource> ds;
     Owned<ADataSource> ds;
     try
     try