Skip to content

Conversation

@wangfenjin
Copy link
Contributor

Add missing method, otherwise there might be link error when using sqlite3 wrapper:

= note: Undefined symbols for architecture x86_64:
          "_sqlite3_bind_zeroblob", referenced from:
              rusqlite::statement::Statement::bind_parameter::h0661d952bc6ba50b in rusqlite-f488f3eb8f4f694a.rusqlite.13sorw3o-cgu.11.rcgu.o
              ...
        ld: symbol(s) not found for architecture x86_64
        clang: error: linker command failed with exit code 1 (use -v to see invocation)

related #949

Change-Id: I25cf2b4a89001972ed56c756ba9d244e7e712780
@wangfenjin wangfenjin changed the title add impl method to fix sqlite3 link error WIP: add impl method to fix sqlite3 link error Jun 10, 2021
@wangfenjin
Copy link
Contributor Author

We can hold on this PR for now, I'm working on other changes

@Mytherin
Copy link
Collaborator

Thanks for the PR! Could you run make format-fix to fix the formatting of the PR? Otherwise I think the PR looks fine.

Change-Id: Iaccde5758ed3c0aabe5fdfd18836124d71eabe3b
@wangfenjin wangfenjin changed the title WIP: add impl method to fix sqlite3 link error Update sqlite3 wrapper for implement rust client Jun 11, 2021
@wangfenjin
Copy link
Contributor Author

Hi @Mytherin , please help review the code.

Please be noted that except for add some unsupported functions, I also update some of the logics.

@wangfenjin wangfenjin mentioned this pull request Jun 11, 2021
Copy link
Collaborator

@Mytherin Mytherin left a comment

Choose a reason for hiding this comment

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

Thanks for the changes! Looks good. Some comments:

Change-Id: I2950f1d06a0ccff2ada659045333e97c1b7b2edd
@wangfenjin
Copy link
Contributor Author

Hi @Mytherin Please help review the code

Copy link
Collaborator

@Mytherin Mytherin left a comment

Choose a reason for hiding this comment

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

Thanks for the changes! Some more comments:

if (length < 0) {
length = 0;
}
return sqlite3_internal_bind_value(stmt, idx, Value::BLOB(string(length, '0')));
Copy link
Collaborator

Choose a reason for hiding this comment

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

This generates the ASCII character 0, not the byte 0 (\0). I imagine zeroblob should generate null bytes, not the character 0, no? Perhaps you could verify this behavior in SQLite itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From SQLite doc:

The zeroblob(N) function returns a BLOB consisting of N bytes of 0x00. SQLite manages these zeroblobs very efficiently. Zeroblobs can be used to reserve space for a BLOB that is later written using incremental BLOB I/O. This SQL function is implemented using the sqlite3_result_zeroblob() routine from the C/C++ interface.

Currently our BLOB value always convert to string, so I mark the api as unsupported for now.

Change-Id: Ib0ee080d30c0e5654d3e33c6ffc7107a2a25e86e
Change-Id: I3c534c4f8056347756b8f1aeec0ad8849d9faa25
@Mytherin Mytherin merged commit 8bc050d into duckdb:master Jun 13, 2021
@Mytherin
Copy link
Collaborator

Thanks! Looks good now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants