equal
deleted
inserted
replaced
39 } |
39 } |
40 |
40 |
41 PreparedStatement* Connection::prepareStatement(relpipe::reader::string_t sql) { |
41 PreparedStatement* Connection::prepareStatement(relpipe::reader::string_t sql) { |
42 SQLHSTMT statement = OdbcCommon::allocateHandle(SQL_HANDLE_STMT, connection); |
42 SQLHSTMT statement = OdbcCommon::allocateHandle(SQL_HANDLE_STMT, connection); |
43 SQLRETURN result = SQLPrepare(statement, (SQLCHAR*) convertor.to_bytes(sql).c_str(), SQL_NTS); |
43 SQLRETURN result = SQLPrepare(statement, (SQLCHAR*) convertor.to_bytes(sql).c_str(), SQL_NTS); |
44 if (OdbcCommon::isNotSuccessful(result)) { |
44 if (OdbcCommon::isNotSuccessful(result)) throw SqlException(L"Unable to prepare statement", result, SQL_HANDLE_STMT, statement, true); |
45 OdbcCommon::freeHandle(SQL_HANDLE_STMT, statement); |
|
46 throw SqlException(L"Unable to prepare statement", result, SQL_HANDLE_DBC, connection); // TODO: SQL_HANDLE_STMT? |
|
47 } |
|
48 return new PreparedStatement(statement); |
45 return new PreparedStatement(statement); |
49 } |
46 } |
50 |
47 |
51 bool Connection::getAutoCommit() { |
48 bool Connection::getAutoCommit() { |
52 // TODO: transaction control |
49 // TODO: transaction control |