PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ drop_table()

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

Definition at line 995 of file raster2pgsql.c.

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

Referenced by process_rasters().

995  {
996  char *sql = NULL;
997  uint32_t len = 0;
998 
999  len = strlen("DROP TABLE IF EXISTS ;") + 1;
1000  if (schema != NULL)
1001  len += strlen(schema);
1002  len += strlen(table);
1003 
1004  sql = rtalloc(sizeof(char) * len);
1005  if (sql == NULL) {
1006  rterror(_("drop_table: Could not allocate memory for DROP TABLE statement"));
1007  return 0;
1008  }
1009  sprintf(sql, "DROP TABLE IF EXISTS %s%s;",
1010  (schema != NULL ? schema : ""),
1011  table
1012  );
1013 
1014  append_sql_to_buffer(buffer, sql);
1015 
1016  return 1;
1017 }
#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:822
Here is the call graph for this function:
Here is the caller graph for this function: