The column named in ip_col *must exist* in the data frame or CSV file. All_names must be valid PostgreSQL syntax for said names. Setting drop=TRUE` is destructive.

create_ip_source_table(pgcon, tbl_name, drop = FALSE, xdf, ip_col = "ip")

Arguments

pgcon

a PostgreSQL DBI connection

tbl_name

name of the IP table (valid PG table name syntax)

drop

drop existing IP table if it has the same name? Defaults to FALSE.

xdf

Data frame to use to populate the table or a path to a CSV file. If a path it will be path.expand()ed.

ip_col

Name of the column that holds the IP addresses

Examples

if (FALSE) {
DBI::dbConnect(
  odbc::odbc(),
  driver = "/usr/local/lib/psqlodbca.so",
  Database = "working",
  Host = "localhost"
) -> con

create_cidr_lookup_table(
  pgcon = con,
  tbl_name = "amazon_cidrs",
  drop = TRUE,
  xdf = system.file("extdat", "amzn-cidrs.csv", package = "pgcidr"),
)

create_ip_source_table(
  pgcon = con,
  tbl_name = "weblog",
  drop = TRUE,
  xdf = system.file("extdat", "weblog.csv", package = "pgcidr")
)

find_ips_in_cidrs(
  con, "weblog", "amazon_cidrs"
)

}