{"action":"created","issue":{"url":"https://api.github.com/repos/rstats-db/odbc/issues/77","repository_url":"https://api.github.com/repos/rstats-db/odbc","labels_url":"https://api.github.com/repos/rstats-db/odbc/issues/77/labels{/name}","comments_url":"https://api.github.com/repos/rstats-db/odbc/issues/77/comments","events_url":"https://api.github.com/repos/rstats-db/odbc/issues/77/events","html_url":"https://github.com/rstats-db/odbc/issues/77","id":237968309,"number":77,"title":"dbWriteTable() errors out when writing dates or datetimes to MS SQL Server via FreeTDS","user":{"login":"harrismcgehee","id":9814456,"avatar_url":"https://avatars0.githubusercontent.com/u/9814456?v=3","gravatar_id":"","url":"https://api.github.com/users/harrismcgehee","html_url":"https://github.com/harrismcgehee","followers_url":"https://api.github.com/users/harrismcgehee/followers","following_url":"https://api.github.com/users/harrismcgehee/following{/other_user}","gists_url":"https://api.github.com/users/harrismcgehee/gists{/gist_id}","starred_url":"https://api.github.com/users/harrismcgehee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harrismcgehee/subscriptions","organizations_url":"https://api.github.com/users/harrismcgehee/orgs","repos_url":"https://api.github.com/users/harrismcgehee/repos","events_url":"https://api.github.com/users/harrismcgehee/events{/privacy}","received_events_url":"https://api.github.com/users/harrismcgehee/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-06-22T20:43:32Z","updated_at":"2017-06-23T16:40:26Z","closed_at":null,"body":"### Issue Description and Expected Result\r\n`dbWriteTable()` errors out when writing dates or datetimes to MS SQL Server via FreeTDS.\r\n\r\nIntegers and characters seem fine.\r\n\r\n### Database\r\nSQL Server 2012, 2016\r\n\r\n### Reproducible Example\r\n``` r\r\n(conn <- UNOSODBC::conn_sql('MODBSAS', database = 'RESEARCH'))\r\n#> <OdbcConnection> MODBSAS\r\n#>   Database: RESEARCH\r\n#>   Microsoft SQL Server Version: 11.00.5678\r\nDBI::dbGetInfo(conn)\r\n#> $dbname\r\n#> [1] \"RESEARCH\"\r\n#> \r\n#> $dbms.name\r\n#> [1] \"Microsoft SQL Server\"\r\n#> \r\n#> $db.version\r\n#> [1] \"11.00.5678\"\r\n#> \r\n#> $username\r\n#> [1] \"\"\r\n#> \r\n#> $host\r\n#> [1] \"\"\r\n#> \r\n#> $port\r\n#> [1] \"\"\r\n#> \r\n#> $sourcename\r\n#> [1] \"MODBSAS\"\r\n#> \r\n#> $servername\r\n#> [1] \"MODBSAS\"\r\n#> \r\n#> $drivername\r\n#> [1] \"libtdsodbc.so\"\r\n#> \r\n#> $odbc.version\r\n#> [1] \"03.52\"\r\n#> \r\n#> $driver.version\r\n#> [1] \"00.95.0081\"\r\n#> \r\n#> $odbcdriver.version\r\n#> [1] \"03.50\"\r\n#> \r\n#> $supports.transactions\r\n#> [1] TRUE\r\n#> \r\n#> attr(,\"class\")\r\n#> [1] \"Microsoft SQL Server\" \"driver_info\"          \"list\"\r\ndf_int <- data.frame(id = 1L:2L)\r\ndf_char <- data.frame(id = letters[1:2])\r\ndf_datetime <- data.frame(psx = Sys.time() + (0:1 * 86400))\r\ndf_date <- data.frame(dte = Sys.Date() + 0:1)\r\ntestthat::expect_equal(TRUE, DBI::dbWriteTable(conn,\"df\", df_int, overwrite=TRUE))\r\ntestthat::expect_equal(TRUE, DBI::dbWriteTable(conn,\"df\", df_char, overwrite=TRUE))\r\nDBI::dbWriteTable(conn,\"df\", df_datetime, overwrite=TRUE)\r\n#> Error in result_insert_dataframe(rs@ptr, values): nanodbc/nanodbc.cpp:1168: 25000: [FreeTDS][SQL Server]The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.\r\nDBI::dbWriteTable(conn,\"df\", df_date, overwrite=TRUE)\r\n#> Error in result_insert_dataframe(rs@ptr, values): nanodbc/nanodbc.cpp:1168: 25000: [FreeTDS][SQL Server]The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.\r\nDBI::dbRemoveTable(conn, name = 'df')\r\nDBI::dbDisconnect(conn)\r\n```\r\n\r\n<details><summary>Session info</summary>\r\n\r\n``` r\r\ndevtools::session_info()\r\n#> Session info --------------------------------------------------------------\r\n#>  setting  value                       \r\n#>  version  R version 3.3.2 (2016-10-31)\r\n#>  system   x86_64, linux-gnu           \r\n#>  ui       X11                         \r\n#>  language (EN)                        \r\n#>  collate  en_US.UTF-8                 \r\n#>  tz       America/New_York            \r\n#>  date     2017-06-22\r\n#> Packages ------------------------------------------------------------------\r\n#>  package    * version    date       source                         \r\n#>  assertthat   0.2.0      2017-04-11 cran (@0.2.0)                  \r\n#>  backports    1.0.5      2017-01-18 CRAN (R 3.3.2)                 \r\n#>  bindr        0.1        2016-11-13 cran (@0.1)                    \r\n#>  bindrcpp     0.2        2017-06-17 CRAN (R 3.3.2)                 \r\n#>  bit          1.1-12     2014-04-09 cran (@1.1-12)                 \r\n#>  bit64        0.9-7      2017-05-08 cran (@0.9-7)                  \r\n#>  blob         1.1.0      2017-06-22 Github (hadley/blob@9dd54d9)   \r\n#>  crayon       1.3.2      2016-06-28 CRAN (R 3.3.2)                 \r\n#>  DBI          0.7        2017-06-18 cran (@0.7)                    \r\n#>  devtools     1.12.0     2016-12-05 CRAN (R 3.3.2)                 \r\n#>  digest       0.6.12     2017-01-27 CRAN (R 3.3.2)                 \r\n#>  dplyr        0.7.1      2017-06-22 CRAN (R 3.3.2)                 \r\n#>  evaluate     0.10       2016-10-11 CRAN (R 3.3.2)                 \r\n#>  glue         1.1.1      2017-06-21 CRAN (R 3.3.2)                 \r\n#>  hms          0.3        2016-11-22 CRAN (R 3.3.2)                 \r\n#>  htmltools    0.3.5      2016-03-21 CRAN (R 3.3.2)                 \r\n#>  ini          0.2        2016-04-01 CRAN (R 3.3.2)                 \r\n#>  knitr        1.15.1     2016-11-22 CRAN (R 3.3.2)                 \r\n#>  magrittr     1.5        2014-11-22 CRAN (R 3.3.2)                 \r\n#>  memoise      1.0.0      2016-01-29 CRAN (R 3.3.2)                 \r\n#>  odbc         1.0.1.9000 2017-06-22 Github (rstats-db/odbc@1e819d8)\r\n#>  pkgconfig    2.0.1      2017-03-21 cran (@2.0.1)                  \r\n#>  R6           2.2.0      2016-10-05 CRAN (R 3.3.2)                 \r\n#>  Rcpp         0.12.11    2017-05-22 CRAN (R 3.3.2)                 \r\n#>  rlang        0.1.1      2017-05-18 CRAN (R 3.3.2)                 \r\n#>  rmarkdown    1.3        2016-12-21 CRAN (R 3.3.2)                 \r\n#>  rprojroot    1.2        2017-01-16 CRAN (R 3.3.2)                 \r\n#>  stringi      1.1.2      2016-10-01 CRAN (R 3.3.2)                 \r\n#>  stringr      1.2.0      2017-02-18 CRAN (R 3.3.2)                 \r\n#>  testthat     1.0.2      2016-04-23 CRAN (R 3.3.2)                 \r\n#>  tibble       1.3.3      2017-05-28 cran (@1.3.3)                  \r\n#>  UNOSODBC     0.1.3      2017-06-22 local                          \r\n#>  withr        1.0.2      2016-06-20 CRAN (R 3.3.2)                 \r\n#>  yaml         2.1.14     2016-11-12 CRAN (R 3.3.2)\r\n```\r\n</details>"},"comment":{"url":"https://api.github.com/repos/rstats-db/odbc/issues/comments/310714764","html_url":"https://github.com/rstats-db/odbc/issues/77#issuecomment-310714764","issue_url":"https://api.github.com/repos/rstats-db/odbc/issues/77","id":310714764,"user":{"login":"harrismcgehee","id":9814456,"avatar_url":"https://avatars0.githubusercontent.com/u/9814456?v=3","gravatar_id":"","url":"https://api.github.com/users/harrismcgehee","html_url":"https://github.com/harrismcgehee","followers_url":"https://api.github.com/users/harrismcgehee/followers","following_url":"https://api.github.com/users/harrismcgehee/following{/other_user}","gists_url":"https://api.github.com/users/harrismcgehee/gists{/gist_id}","starred_url":"https://api.github.com/users/harrismcgehee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harrismcgehee/subscriptions","organizations_url":"https://api.github.com/users/harrismcgehee/orgs","repos_url":"https://api.github.com/users/harrismcgehee/repos","events_url":"https://api.github.com/users/harrismcgehee/events{/privacy}","received_events_url":"https://api.github.com/users/harrismcgehee/received_events","type":"User","site_admin":false},"created_at":"2017-06-23T16:40:26Z","updated_at":"2017-06-23T16:40:26Z","body":"Are you sure that the \r\n`#> $driver.version\r\n#> [1] \"00.95.0081\"`\r\ncomes from freeTDS? \r\n\r\nI just downloaded the freetds v1.1.dev.20170623 and my number is still at `00.95.0081`.\r\n\r\nHow do I figure out where that is coming from?\r\n"}}
{"actor":{"display_login":"harrismcgehee"}}