[
https://issues.apache.org/jira/browse/TRAFODION-2726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16179872#comment-16179872
]
ASF GitHub Bot commented on TRAFODION-2726:
-------------------------------------------
Github user DaveBirdsall commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/1237#discussion_r140911804
--- Diff: core/conn/odb/src/JsonReader.c ---
@@ -0,0 +1,563 @@
+//------------------------------------------------------------------
+//
+// @@@ START COPYRIGHT @@@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// @@@ END COPYRIGHT @@@
+
+#include "JsonReader.h"
+#include <errno.h>
+#include <string.h>
+
+JsonReader *jsonReaderNew(const char *path)
+{
+ JsonReader *pJsonReader = (JsonReader *)calloc(1, sizeof(JsonReader));
+ if (!pJsonReader) {
+ return NULL;
+ }
+
+ pJsonReader->jsonFile = fopen(path, "r");
+ if (!pJsonReader->jsonFile) {
+ free(pJsonReader);
+ return NULL;
+ }
+
+ strncpy(pJsonReader->jsonFileName, path,
JSON_PARSER_MAX_FILE_NAME_LEN);
--- End diff --
If the path is too long, there won't be a null terminator. To be safe, you
may want to set the last character in the buffer to the null character after
the strncpy call.
> odb support to load json file
> -----------------------------
>
> Key: TRAFODION-2726
> URL: https://issues.apache.org/jira/browse/TRAFODION-2726
> Project: Apache Trafodion
> Issue Type: New Feature
> Components: db-utility-odb
> Reporter: 苏锦佩
> Priority: Minor
> Fix For: 2.3-incubating
>
>
> json is popular data storage format, so we want to support it on odb.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)