1029 assert(table != NULL);
1030 assert(column != NULL);
1032 len = strlen(
"CREATE TABLE (\"rid\" serial PRIMARY KEY, raster);") + 1;
1034 len += strlen(schema);
1035 len += strlen(table);
1036 len += strlen(column);
1038 len += strlen(
", text") + strlen(file_column_name);
1039 if (tablespace != NULL)
1040 len += strlen(
" TABLESPACE ") + strlen(tablespace);
1041 if (idx_tablespace != NULL)
1042 len += strlen(
" USING INDEX TABLESPACE ") + strlen(idx_tablespace);
1044 sql =
rtalloc(
sizeof(
char) * len);
1046 rterror(
_(
"create_table: Could not allocate memory for CREATE TABLE statement"));
1049 sprintf(sql,
"CREATE TABLE %s%s (\"rid\" serial PRIMARY KEY%s%s,%s raster%s%s%s)%s%s;",
1050 (schema != NULL ? schema :
""),
1052 (idx_tablespace != NULL ?
" USING INDEX TABLESPACE " :
""),
1053 (idx_tablespace != NULL ? idx_tablespace :
""),
1055 (file_column ?
"," :
""),
1056 (file_column ? file_column_name :
""),
1057 (file_column ?
" text" :
""),
1058 (tablespace != NULL ?
" TABLESPACE " :
""),
1059 (tablespace != NULL ? tablespace :
"")
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
void * rtalloc(size_t size)
Wrappers used for managing memory.
static int append_sql_to_buffer(STRINGBUFFER *buffer, const char *str)