Giter Club home page Giter Club logo

db_conn's People

Contributors

vimsh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

db_conn's Issues

LNK2005: "virtual struct vgi::dbconn::dbi::istatement * __thiscall vgi::dbconn::dbd::sybase::connection::get_statement(struct vgi::dbconn::dbi::iconnection &)" already defined

This is a very good cpp api for sybase, it works well in single cpp file, but when i include "sybase_driver.hpp" into a header file 'a.h', and an other file include the file 'a.h'。When complie&link the project, a link error has occurred:


LNK2005: "virtual struct vgi::dbconn::dbi::istatement * __thiscall vgi::dbconn::dbd::sybase::connection::get_statement(struct vgi::dbconn::dbi::iconnection &)" already defined

It seems to point to the end of the file sybase_driver.hpp:

dbi::istatement* connection::get_statement(dbi::iconnection& iconn)
{
return new statement(dynamic_cast<connection&>(iconn));
}

So, how to solve the problem? Thank you!

I separate this function from the file to a .cpp file, and then add all this files to project.
This can solve the link error.

Strings garbled (sybase api version: CS_VERSION_125 )

When i fetch a little amount of data, the strings returned are correct. But when the volume of records increases, most of the data(datatype CS_CHAR_TYPE) behind is incorrect: correct string followed by garbled.

I'm not familiar with Sybase APIs, and made some changes in sybase_driver.hpp.

1, below the function 'ct_describe' about line 620, I add this:
if (columns[i].datatype == CS_CHAR_TYPE) { columns[i].format = CS_FMT_PADNULL; }

2, comments 2 lines at line 196:
//if (CS_ROW_FAIL == retcode)
// throw std::runtime_error(std::string(FUNCTION).append(": Error fetching row ").append(std::to_string(result)));

3, In function "void process_result(bool compute, bool bind)" about line 645, add 3 lines:
if (columns[i].datatype == CS_CHAR_TYPE)
columndata[i].allocate(columns[i].maxlength + 2);
else
columndata[i].allocate(columns[i].maxlength);

4, Commented on the associated exception about line 710

After 4 steps, it works in debug mode(crashed in release mode), but still throw exceptions in callback functions, so i comment cs_msg_callback, ct_msg_callback and srv_msg_callback in the constructor of driver.

While this can get the right results, I'm not sure it's the right approach, and are there other better ways to fix it?

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.