void print_name(char *name, char *uri)
{
- printf("INSERT INTO objectName VALUES ('%s', '%s');\n",uri,name);
+ size_t len = strlen(uri) + 1;
+ char *quri = malloc (sizeof(char) * len * 2);
+ PQescapeString(quri,uri,len);
+ len = strlen(name) + 1;
+ char *qname = malloc (sizeof(char) * len * 2);
+ PQescapeString(qname,name,len);
+ printf("INSERT INTO objectName VALUES ('%s', '%s');\n",quri,qname);
+ free(quri);
+ free(qname);
}
/****************************************************************/
char *qabout = malloc (sizeof(char) * len * 2);
PQescapeString(qabout,about,len);
printf("INSERT INTO refRel VALUES ('%s', 'http://www.cs.unibo.it/helm/schemas/schema-helm#MainHypothesis', %d);\n",qabout,curr->val);
+ free(qabout);
curr = curr->next;
}
}
char *qabout = malloc (sizeof(char) * len * 2);
PQescapeString(qabout,about,len);
printf("INSERT INTO refSort VALUES ('%s', 'http://www.cs.unibo.it/helm/schemas/schema-helm#MainHypothesis', %d, '%s');\n",qabout,curr->val,uri);
+ free(qabout);
curr = curr->next;
}
}
quri = malloc (sizeof(char) * len * 2);
PQescapeString(quri,uri,len);
printf("INSERT INTO refObj VALUES ('%s', '%s', 'http://www.cs.unibo.it/helm/schemas/schema-helm#MainHypothesis', %d);\n",qabout,quri,curr->val);
+ free(qabout);
+ free(quri);
curr = curr->next;
}
}
char *qabout = malloc (sizeof(char) * len * 2);
PQescapeString(qabout,about,len);
printf("INSERT INTO refRel VALUES ('%s', 'http://www.cs.unibo.it/helm/schemas/schema-helm#MainConclusion', %d);\n",qabout,depth);
+ free(qabout);
}
else if ((!strcmp(uri,"Prop")) || (!strcmp(uri,"Type")) ||
(!strcmp(uri,"Set")))
char *qabout = malloc (sizeof(char) * len * 2);
PQescapeString(qabout,about,len);
printf("INSERT INTO refSort VALUES ('%s', 'http://www.cs.unibo.it/helm/schemas/schema-helm#MainConclusion', %d, '%s');\n",qabout,depth,uri);
+ free(qabout);
}
else
{
quri = malloc (sizeof(char) * len * 2);
PQescapeString(quri,uri,len);
printf("INSERT INTO refObj VALUES ('%s', '%s','http://www.cs.unibo.it/helm/schemas/schema-helm#MainConclusion', %d);\n",qabout,quri,depth);
+ free(qabout);
+ free(quri);
}
}
position="MainConclusion"; /* This should never happen */
printf("INSERT INTO refObj VALUES ('%s', '%s', \
'http://www.cs.unibo.it/helm/schemas/schema-helm#%s', NULL);\n",qabout,quri,position);
+ free(qabout);
+ free(quri);
}
/* The following function allocates a bucket for an identifier. */