PostGIS  2.5.2dev-r@@SVN_REVISION@@

◆ drop_table()

static int drop_table ( const char *  schema,
const char *  table,
STRINGBUFFER buffer 
)
static

Definition at line 998 of file raster2pgsql.c.

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

Referenced by process_rasters().

998  {
999  char *sql = NULL;
1000  uint32_t len = 0;
1001 
1002  len = strlen("DROP TABLE IF EXISTS ;") + 1;
1003  if (schema != NULL)
1004  len += strlen(schema);
1005  len += strlen(table);
1006 
1007  sql = rtalloc(sizeof(char) * len);
1008  if (sql == NULL) {
1009  rterror(_("drop_table: Could not allocate memory for DROP TABLE statement"));
1010  return 0;
1011  }
1012  sprintf(sql, "DROP TABLE IF EXISTS %s%s;",
1013  (schema != NULL ? schema : ""),
1014  table
1015  );
1016 
1017  append_sql_to_buffer(buffer, sql);
1018 
1019  return 1;
1020 }
#define _(String)
Definition: shpcommon.h:24
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
Definition: rt_context.c:199
void * rtalloc(size_t size)
Wrappers used for managing memory.
Definition: rt_context.c:171
unsigned int uint32_t
Definition: uthash.h:78
static int append_sql_to_buffer(STRINGBUFFER *buffer, const char *str)
Definition: raster2pgsql.c:825
Here is the call graph for this function:
Here is the caller graph for this function: