X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fmetadata%2Fextractor%2Fsthandler.c;h=87e0d49c71e0833ec4d29afd8123fb5ef1aaff12;hb=4167cea65ca58897d1a3dbb81ff95de5074700cc;hp=d028952932a001776758932a1e73e0751f12a125;hpb=ba1f274e210f575dc5cd94500611f6bd5ad67186;p=helm.git diff --git a/helm/metadata/extractor/sthandler.c b/helm/metadata/extractor/sthandler.c index d02895293..87e0d49c7 100644 --- a/helm/metadata/extractor/sthandler.c +++ b/helm/metadata/extractor/sthandler.c @@ -249,7 +249,15 @@ void print_all(about,conn) 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); } /****************************************************************/ @@ -294,6 +302,7 @@ void print_mainhyp(about,uri,l) 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; } } @@ -307,6 +316,7 @@ void print_mainhyp(about,uri,l) 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; } } @@ -323,6 +333,8 @@ void print_mainhyp(about,uri,l) 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; } } @@ -341,6 +353,7 @@ void print_mainconcl(about,uri,depth) 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"))) @@ -349,6 +362,7 @@ void print_mainconcl(about,uri,depth) 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 { @@ -360,6 +374,8 @@ void print_mainconcl(about,uri,depth) 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); } } @@ -389,6 +405,8 @@ void print_one(about,uri,pos) 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. */