/* * 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. */ #include "postgres.h" #include "utils/load/ag_load_edges.h" #include "utils/load/ag_load_labels.h" #include "utils/load/age_load.h" #include "pg_fix.h" agtype *create_empty_agtype(void) { agtype* out; agtype_in_state result; memset(&result, 0, sizeof(agtype_in_state)); result.res = push_agtype_value(&result.parse_state, WAGT_BEGIN_OBJECT, NULL); result.res = push_agtype_value(&result.parse_state, WAGT_END_OBJECT, NULL); out = agtype_value_to_agtype(result.res); pfree_agtype_in_state(&result); return out; } agtype *create_agtype_from_list(char **header, char **fields, size_t fields_len, int64 vertex_id) { agtype* out; agtype_value* key_agtype; agtype_value* value_agtype; agtype_in_state result; int i; memset(&result, 0, sizeof(agtype_in_state)); result.res = push_agtype_value(&result.parse_state, WAGT_BEGIN_OBJECT, NULL); key_agtype = string_to_agtype_value("__id__"); result.res = push_agtype_value(&result.parse_state, WAGT_KEY, key_agtype); value_agtype = integer_to_agtype_value(vertex_id); result.res = push_agtype_value(&result.parse_state, WAGT_VALUE, value_agtype); pfree_agtype_value(key_agtype); pfree_agtype_value(value_agtype); for (i = 0; i