[unixODBC-support] Correct closing the cursor

Daniil A Megrabjan danil.megrabjan at gmail.com
Mon Apr 19 10:01:53 BST 2010


Hello

I'm using Sybase Anywhere 9 driver with unixODBC. I do a simple query
SELECT * FROM TABLE1, and then I close the cursor. The problem is that
after closing the shared lock remains, that is why I can not write
anything in this table. How I must close cursors correctly, any
ideas?!

Now.

Open:
====
SQLAllocHandle(SQL_HANDLE_STMT, Connection->DbcHandle, &Stmt);
SQLSetStmtAttr(Stmt, SQL_ATTR_CURSOR_SENSITIVITY, (void *) SQL_INSENSITIVE, 0);
SQLSetStmtAttr(Stmt, SQL_ATTR_CONCURRENCY, (void *) SQL_CONCUR_READ_ONLY, 0);
SQLSetStmtAttr(Stmt, SQL_ATTR_USE_BOOKMARKS, (void *) SQL_UB_VARIABLE, 0);
SQLSetStmtAttr(Stmt, SQL_CURSOR_TYPE, (void *) SQL_CURSOR_KEYSET_DRIVEN, 0);
SQLPrepare(Stmt, (unsigned char *) SQL, SQL_NTS);
SQLExecute(Stmt);

Close:
====
SQLCloseCursor(Stmt);
SQLFreeStmt(Stmt, SQL_UNBIND);
SQLFreeHandle(SQL_HANDLE_STMT, Stmt);
Stmt = SQL_NULL_HANDLE;

-- 
Daniil A Megrabjan | email danil.megrabjan at gmail.com | icq 4545450 |
skype danil.megrabjan


More information about the unixODBC-support mailing list