[ODBC-44] Binding of SQL_C_TIMESTAMP to SQL_TIME does not work(correctly) Created: 2016-06-07  Updated: 2016-06-07  Resolved: 2016-06-07

Status: Closed
Project: MariaDB Connector/ODBC
Component/s: None
Affects Version/s: 2.0.10
Fix Version/s: 2.0.11

Type: Bug Priority: Major
Reporter: Lawrin Novitsky Assignee: Lawrin Novitsky
Resolution: Fixed Votes: 0
Labels: None


 Description   

This affects work with MS Access, if the table contains `time` field.

The testcase would be smth like following

rc = SQLExecDirect(Stmt,"create table t_tstotime(col1 date, col2 time, col3 timestamp)", SQL_NTS);
CHECK_STMT_RC(Stmt,rc);

rc = SQLTransact(NULL,Connection,SQL_COMMIT);
CHECK_DBC_RC(Connection,rc);

rc = SQLFreeStmt(Stmt,SQL_CLOSE);
CHECK_STMT_RC(Stmt,rc);

/* TIMESTAMP TO DATE, TIME and TS CONVERSION */
rc = SQLPrepare(Stmt, (SQLCHAR *)"insert into t_tstotime(col1, col2, col3) values(?,?,?)",SQL_NTS);
CHECK_STMT_RC(Stmt,rc);

rc = SQLBindParameter(Stmt,1,SQL_PARAM_INPUT,SQL_C_TIMESTAMP,
SQL_DATE,0,0,&ts2,sizeof(ts2),NULL);

CHECK_STMT_RC(Stmt,rc);

CHECK_STMT_RC(Stmt, SQLBindParameter(Stmt,2,SQL_PARAM_INPUT,SQL_C_TIMESTAMP,
SQL_TIME,0,0,&ts1,sizeof(ts1),NULL));

rc = SQLBindParameter(Stmt,3,SQL_PARAM_INPUT,SQL_C_TIMESTAMP,
SQL_TIMESTAMP,0,0,&ts,sizeof(ts),NULL);
CHECK_STMT_RC(Stmt,rc);

rc = SQLExecute(Stmt);
CHECK_STMT_RC(Stmt,rc);

rc = SQLFreeStmt(Stmt, SQL_UNBIND);
CHECK_STMT_RC(Stmt,rc);

CHECK_STMT_RC(Stmt, SQLFreeStmt(Stmt, SQL_CLOSE));

CHECK_STMT_RC(Stmt, SQLBindParameter(Stmt, 1, SQL_PARAM_INPUT, SQL_C_TIMESTAMP,
SQL_TIME, 0, 0, &ts1, sizeof(ts1), NULL));

OK_SIMPLE_STMT(Stmt, "SELECT * FROM t_tstotime WHERE col2= ?");

IS(1 == myrowcount(Stmt));



 Comments   
Comment by Lawrin Novitsky [ 2016-06-07 ]

Fix+testcase have been pushed(commit 34cf2a3681a385bf7bfa727b95a489107a5f4186)

Generated at Thu Feb 08 03:25:49 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.