1172 {
1174 uint32_t len = 0;
1175
1176 char *_tmp = NULL;
1177 char *_schema = NULL;
1178 char *_table = NULL;
1179 char *_column = NULL;
1180
1181 assert(table != NULL);
1182 assert(column != NULL);
1183
1184
1185 if (schema != NULL) {
1191 _schema = _tmp;
1192 }
1193
1194
1198
1199
1203
1204 len = strlen("SELECT AddRasterConstraints('','','',TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,FALSE);") + 1;
1205 if (_schema != NULL)
1206 len += strlen(_schema);
1207 len += strlen(_table);
1208 len += strlen(_column);
1209
1211 if (sql == NULL) {
1212 rterror(
_(
"add_raster_constraints: Could not allocate memory for AddRasterConstraints statement"));
1213 return 0;
1214 }
1215 sprintf(sql, "SELECT AddRasterConstraints('%s','%s','%s',TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,%s,TRUE,TRUE,TRUE,TRUE,%s);",
1216 (_schema != NULL ? _schema : ""),
1217 _table,
1218 _column,
1219 (regular_blocking ? "TRUE" : "FALSE"),
1220 (max_extent ? "TRUE" : "FALSE")
1221 );
1222
1223 if (_schema != NULL)
1227
1229
1230 return 1;
1231}
void rterror(const char *fmt,...) __attribute__((format(printf
Wrappers used for reporting errors and info.
void * rtalloc(size_t size)
Wrappers used for managing memory.
void rtdealloc(void *mem)
Datum buffer(PG_FUNCTION_ARGS)
static int append_sql_to_buffer(STRINGBUFFER *buffer, const char *str)
static char * strreplace(const char *str, const char *oldstr, const char *newstr, int *count)
static char * chartrim(const char *input, char *remove)