Skip to content

SQLGetData API call #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Aug 13, 2018
Merged

SQLGetData API call #14

merged 14 commits into from
Aug 13, 2018

Conversation

bpintea
Copy link
Collaborator

@bpintea bpintea commented Aug 10, 2018

This PR adds the implementation for SQLGetData(). This function is an alternative to column binding: while SQLBindColumn() binds multiple subsequently have have all the bound buffers have data copied into with one SQLFetch() call, SQLGetData() will fetch one single column at a time. This functionality is used for "long data": in case the data source has a large amount of data in one (or multiple columns), it might not be feasible for the application to bind large enough buffers and have all the data in one go.

Theoretically the driver could access the cell data synchronously (or quasi~) with each SQLGetData call. In case of Elasticsearch/SQL however, this is not needed/possible, since each REST call will return an entire row.

bpintea added 12 commits July 29, 2018 17:27
The setup API is meant to assist with installation of the driver.
stderr redirect will always work
- prompt_user_config() will pop up a dialog-box for connection config;
- prompt_user_overwrite() will confirm with the user that a config is to
be overwritten.
builds/.gitignore can get cleaned away, move its content into top
.gitignore
- add a DSN to start from;
- remove small code duplication in SQLDriverConnect;
- change config priorities in ConfigDSN(), as follows (most relevant
first):
  . 00-list received as parameter;
  . registry values;
  . defaults.
The values from the registry are read into a static buffer, indexed for
each entry into the esodbc_dsn_attrs_st structure.
Make sure that the indexing is done only for those values in the
Registry that have a correspondence in the structure.

Also, use SQLWCHAR explicitely instead of the TCHAR (should be same
values for Unicode compilation, but might generate issues later.)
Moved from all-static/all-dynamic to all-static, to simplify code
management.
- add a few more attributes to SQLGetInfo, some describing SQLGetData
extentions
- WIP on SQLGetData: set-up the temporary binding-unbinding on the
requested column.

Since SQLGetData requires no state maintenance except position in the
source data, the binding is done with a static ARD; if the column index
is lower-or-equal to a constant (128), the ARD will also use a static
array of records; otherwise a new array is allocated-freed.
Also:
- replace boolean conversion function, delegate that to the long long
conversion function;
- unify functions transfering SQLWCHAR and SQLCHAR strings
to application to minimize code duplication;
- build.bat : stop on error and propagate it to script exit;
- CMakeLists.txt: add flag for parallel building.
move around the 0-terminator accounting, for better code clarity
@bpintea bpintea mentioned this pull request Aug 10, 2018
Closed
Copy link
Contributor

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I just saw a couple of nits you might want to revisit.

build.bat Outdated
:END
echo %ERRORLEVEL%
exit /b 0
exit /b %ERRORLEVEL%
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like only one of these exits should be here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, thanks, fixed.

.gitignore Outdated
@@ -1,3 +1,5 @@
*.swp
driver/*.swp
builds/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the canonical way to ignore a whole directory is just to list the directory name with a slash (no star). I.e. builds/.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed.

@bpintea bpintea merged commit aedca96 into elastic:master Aug 13, 2018
@bpintea bpintea deleted the feature/getdata branch August 13, 2018 15:47
@bpintea bpintea added >feature Applicable to PRs adding new functionality v6.5.0 labels May 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>feature Applicable to PRs adding new functionality v6.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants