Can anybody tell me how to use BIND argument with postgresql.
I admit I know nothing about binding and I was not able to search how to bind parameters through R. I can do that via SQL but not through R.
This is a very childish CODE but it's good enough for me to understand.
library(DBI)
library(RPostgres)
library(magrittr)
PSQLcon <-dbConnect(
RPostgres::Postgres(),
user = 'postgres' #LoginValue$user
,
password = 'Gurgaon@65' #LoginValue$password
,
dbname = 'HRMS'
)
dbSendStatement(
PSQLcon,"insert into dropdown.states values (current_timestamp,$state)",c("JK"))%>%
dbBind(list(Sys.time(),"JK"))
dbGetQuery(PSQLcon,"select * from dropdown.states where states = $s",list(data.frame(s="RJ")))
Can you please tell me how to bind the parameters to getQuery and SendQuery Method so that I can insert data and get data from POSTGRESQL.
and Notice I am using RPostgres instead of RPostgresQL. Let me know if that does have any difference.
I have heard that it is faster and more maintainable. Please do reply.