1255 char *_ovschema = NULL;
1256 char *_ovtable = NULL;
1257 char *_ovcolumn = NULL;
1259 char *_schema = NULL;
1260 char *_table = NULL;
1261 char *_column = NULL;
1263 assert(ovtable != NULL);
1264 assert(ovcolumn != NULL);
1265 assert(table != NULL);
1266 assert(column != NULL);
1270 if (ovschema != NULL) {
1274 _tmp =
strreplace(_ovschema,
"'",
"''", NULL);
1281 _ovtable =
strreplace(_tmp,
"'",
"''", NULL);
1286 _ovcolumn =
strreplace(_tmp,
"'",
"''", NULL);
1290 if (schema != NULL) {
1309 len = strlen(
"SELECT AddOverviewConstraints('','','','','','',);") + 5;
1310 if (_ovschema != NULL)
1311 len += strlen(_ovschema);
1312 len += strlen(_ovtable);
1313 len += strlen(_ovcolumn);
1314 if (_schema != NULL)
1315 len += strlen(_schema);
1316 len += strlen(_table);
1317 len += strlen(_column);
1319 sql =
rtalloc(
sizeof(
char) * len);
1321 rterror(
_(
"add_overview_constraints: Could not allocate memory for AddOverviewConstraints statement"));
1324 sprintf(sql,
"SELECT AddOverviewConstraints('%s','%s','%s','%s','%s','%s',%d);",
1325 (_ovschema != NULL ? _ovschema :
""),
1328 (_schema != NULL ? _schema :
""),
1334 if (_ovschema != NULL)
1339 if (_schema != NULL)
static char * chartrim(const char *input, char *remove)
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
void * rtalloc(size_t size)
Wrappers used for managing memory.
static char * strreplace(const char *str, const char *oldstr, const char *newstr, int *count)
static int append_sql_to_buffer(STRINGBUFFER *buffer, const char *str)
void rtdealloc(void *mem)