PostGIS  2.1.10dev-r@@SVN_REVISION@@
static int drop_table ( const char *  schema,
const char *  table,
STRINGBUFFER buffer 
)
static

Definition at line 922 of file raster2pgsql.c.

References _, append_sql_to_buffer(), rtalloc(), rtdealloc(), rterror(), and rtgdalraster::sql.

Referenced by process_rasters().

922  {
923  char *sql = NULL;
924  uint32_t len = 0;
925 
926  len = strlen("DROP TABLE IF EXISTS ;") + 1;
927  if (schema != NULL)
928  len += strlen(schema);
929  len += strlen(table);
930 
931  sql = rtalloc(sizeof(char) * len);
932  if (sql == NULL) {
933  rterror(_("drop_table: Could not allocate memory for DROP TABLE statement"));
934  return 0;
935  }
936  sprintf(sql, "DROP TABLE IF EXISTS %s%s;",
937  (schema != NULL ? schema : ""),
938  table
939  );
940 
941  append_sql_to_buffer(buffer, sql);
942  rtdealloc(sql);
943 
944  return 1;
945 }
void rtdealloc(void *mem)
Definition: rt_api.c:882
#define _(String)
Definition: shpcommon.h:23
static int append_sql_to_buffer(STRINGBUFFER *buffer, const char *str)
Definition: raster2pgsql.c:820
void * rtalloc(size_t size)
Raster core memory management functions.
Definition: rt_api.c:867
void rterror(const char *fmt,...)
Raster core error and info handlers.
Definition: rt_api.c:895

Here is the call graph for this function:

Here is the caller graph for this function: