2004 {
2005 uint32_t i = 0;
2006
2007 assert(config != NULL);
2008 assert(config->
table != NULL);
2010
2013 rterror(
_(
"process_rasters: Could not add BEGIN statement to string buffer"));
2014 return 0;
2015 }
2016 }
2017
2018
2019 if (config->
opt ==
'd') {
2021 rterror(
_(
"process_rasters: Could not add DROP TABLE statement to string buffer"));
2022 return 0;
2023 }
2024
2028 rterror(
_(
"process_rasters: Could not add an overview's DROP TABLE statement to string buffer"));
2029 return 0;
2030 }
2031 }
2032 }
2033 }
2034
2035
2036 if (config->
opt !=
'a') {
2042 )) {
2043 rterror(
_(
"process_rasters: Could not add CREATE TABLE statement to string buffer"));
2044 return 0;
2045 }
2046
2054 )) {
2055 rterror(
_(
"process_rasters: Could not add an overview's CREATE TABLE statement to string buffer"));
2056 return 0;
2057 }
2058 }
2059 }
2060 }
2061
2062
2063 if (config->
opt !=
'p') {
2066
2067
2071
2073
2076
2077
2079 rterror(
_(
"process_rasters: Could not process raster: %s"), config->
rt_file[i]);
2082 return 0;
2083 }
2084
2085
2089 config->file_column_name,
2090 config->copy_statements, config->out_srid,
2092 )) {
2093 rterror(
_(
"process_rasters: Could not convert raster tiles into INSERT or COPY statements"));
2096 return 0;
2097 }
2098
2100
2101
2103
2104
2106 uint32_t j = 0;
2107
2109
2111 rterror(
_(
"process_rasters: Could not create overview of factor %d for raster %s"), config->
overview[j], config->
rt_file[i]);
2114 return 0;
2115 }
2116
2120 config->copy_statements, config->out_srid,
2122 )) {
2123 rterror(
_(
"process_rasters: Could not convert overview tiles into INSERT or COPY statements"));
2126 return 0;
2127 }
2128
2130
2131
2133 }
2134 }
2135
2137 if (i < 1)
2139 else {
2141 }
2142 }
2143
2145 }
2146
2148 }
2149
2150
2152
2157 )) {
2158 rterror(
_(
"process_rasters: Could not add CREATE INDEX statement to string buffer"));
2159 return 0;
2160 }
2161
2162
2163 if (config->
opt !=
'p') {
2167 )) {
2168 rterror(
_(
"process_rasters: Could not add ANALYZE statement to string buffer"));
2169 return 0;
2170 }
2171 }
2172
2175
2180 )) {
2181 rterror(
_(
"process_rasters: Could not add an overview's CREATE INDEX statement to string buffer"));
2182 return 0;
2183 }
2184
2185
2186 if (config->
opt !=
'p') {
2190 )) {
2191 rterror(
_(
"process_rasters: Could not add an overview's ANALYZE statement to string buffer"));
2192 return 0;
2193 }
2194 }
2195 }
2196 }
2197 }
2198
2199
2205 )) {
2206 rterror(
_(
"process:rasters: Could not add AddRasterConstraints statement to string buffer"));
2207 return 0;
2208 }
2209
2216 )) {
2217 rterror(
_(
"process_rasters: Could not add an overview's AddRasterConstraints statement to string buffer"));
2218 return 0;
2219 }
2220 }
2221 }
2222 }
2223
2224
2232 )) {
2233 rterror(
_(
"process_rasters: Could not add an overview's AddOverviewConstraints statement to string buffer"));
2234 return 0;
2235 }
2236 }
2237 }
2238
2241 rterror(
_(
"process_rasters: Could not add END statement to string buffer"));
2242 return 0;
2243 }
2244 }
2245
2246
2251 )) {
2252 rterror(
_(
"process_rasters: Could not add VACUUM statement to string buffer"));
2253 return 0;
2254 }
2255
2261 )) {
2262 rterror(
_(
"process_rasters: Could not add an overview's VACUUM statement to string buffer"));
2263 return 0;
2264 }
2265 }
2266 }
2267
2268 }
2269
2270 return 1;
2271}
void rterror(const char *fmt,...) __attribute__((format(printf
Wrappers used for reporting errors and info.
Datum buffer(PG_FUNCTION_ARGS)
static int add_overview_constraints(const char *ovschema, const char *ovtable, const char *ovcolumn, const char *schema, const char *table, const char *column, const int factor, STRINGBUFFER *buffer)
static int append_sql_to_buffer(STRINGBUFFER *buffer, const char *str)
static int build_overview(int idx, RTLOADERCFG *config, RASTERINFO *info, uint32_t ovx, STRINGBUFFER *tileset, STRINGBUFFER *buffer)
static void diff_rastinfo(RASTERINFO *x, RASTERINFO *ref)
static int convert_raster(int idx, RTLOADERCFG *config, RASTERINFO *info, STRINGBUFFER *tileset, STRINGBUFFER *buffer)
static void rtdealloc_stringbuffer(STRINGBUFFER *buffer, int freebuffer)
static int insert_records(const char *schema, const char *table, const char *column, const char *filename, const char *file_column_name, int copy_statements, int out_srid, STRINGBUFFER *tileset, STRINGBUFFER *buffer)
static void flush_stringbuffer(STRINGBUFFER *buffer)
static void rtdealloc_rastinfo(RASTERINFO *info)
static void init_rastinfo(RASTERINFO *info)
static int vacuum_table(const char *schema, const char *table, STRINGBUFFER *buffer)
static int create_index(const char *schema, const char *table, const char *column, const char *tablespace, STRINGBUFFER *buffer)
static int add_raster_constraints(const char *schema, const char *table, const char *column, int regular_blocking, int max_extent, STRINGBUFFER *buffer)
static int drop_table(const char *schema, const char *table, STRINGBUFFER *buffer)
static int copy_rastinfo(RASTERINFO *dst, RASTERINFO *src)
static void init_stringbuffer(STRINGBUFFER *buffer)
static int analyze_table(const char *schema, const char *table, STRINGBUFFER *buffer)
static int create_table(const char *schema, const char *table, const char *column, const int file_column, const char *file_column_name, const char *tablespace, const char *idx_tablespace, STRINGBUFFER *buffer)