1160 {
1162 uint32_t len = 0;
1163
1164 char *_tmp = NULL;
1165 char *_schema = NULL;
1166 char *_table = NULL;
1167 char *_column = NULL;
1168
1169 assert(table != NULL);
1170 assert(column != NULL);
1171
1172
1173 if (schema != NULL) {
1179 _schema = _tmp;
1180 }
1181
1182
1186
1187
1191
1192 len = strlen("SELECT AddRasterConstraints('','','',TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,FALSE);") + 1;
1193 if (_schema != NULL)
1194 len += strlen(_schema);
1195 len += strlen(_table);
1196 len += strlen(_column);
1197
1199 if (sql == NULL) {
1200 rterror(
_(
"add_raster_constraints: Could not allocate memory for AddRasterConstraints statement"));
1201 return 0;
1202 }
1203 sprintf(sql, "SELECT AddRasterConstraints('%s','%s','%s',TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,%s,TRUE,TRUE,TRUE,TRUE,%s);",
1204 (_schema != NULL ? _schema : ""),
1205 _table,
1206 _column,
1207 (regular_blocking ? "TRUE" : "FALSE"),
1208 (max_extent ? "TRUE" : "FALSE")
1209 );
1210
1211 if (_schema != NULL)
1215
1217
1218 return 1;
1219}
void rterror(const char *fmt,...)
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)