Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AD-608] Add support for nullable data (#38)
* [AD-608] refactor change * [AD-608] implement boost::optional for ResultSetGetString * both ResultSetGetString by index and by column name are modified * [AD-608] update java_test to accommodate boost::optional * if value should be null, checking for optional value being non-existent is enabled, and if value should not be null, checking for optional value being existent is enabled * (* operator) is use for boost::optional<std::string>. For details, see https://www.boost.org/doc/libs/1_78_0/libs/optional/doc/html/boost_optional/quick_start.html * [AD-608] update result_set GetString * update to accommodate boost::optional<std::string> * [AD-608] update jni_test to accommodate boost::optional * if value should be null, checking for optional value being non-existent is enabled, and if value should not be null, checking for optional value being existent is enabled * (* operator) is use for boost::optional<std::string>. For details, see https://www.boost.org/doc/libs/1_78_0/libs/optional/doc/html/boost_optional/quick_start.html * [AD-608] add include boost/optional for jni_test.cpp * [AD-608] implement boost::optional<std::string> in column_meta * catalogName, schemaName, tableName, columnName, remarks, columnDef are now boost::optional<std::string> * [AD-608] make ColumnMeta constructor accept std::string as parameters again * [AD-608] define PutOptString function in ApplicationDataBuffer namespace * [AD-608] add include headers for boost/optional * <boost/optional/optional_io.hpp> header is included because boost::optional<T> needs to be returned. * [AD-608] change std::string to boost::optional in table_meta.h * [AD-608] call PutOptString in metadata_query * replace PutString with PutOptString inside column_metatdata_query and table_metadata_query * [AD-608] update BOOST_CHECK * since nullable Strings are now supported, set BOOST_CHECK_EQUAL to true instead of false. * remove todo comments * [AD-608] bugfix include * [AD-608] implement nullable int in java.cpp * [AD-608] update java_test to support nullable int * [AD-608] update resultSet to support nullable int * [AD-608] refactor/format changes * [AD-608] add checks for nullable strings * [AD-608] remove empty string initialization * [AD-608] implement optional int in application_buffer * [AD-608] make type_traits accept optional parameters * [AD-608] change NullabilityToIsNullable to accept int32_t * [AD-608] make column_meta support nullable int * make column_metadata_query call putOptInt*. * change columnType from uint8_t to int16_t, because data_type could be a negative value. * replace currentColumn.GetDataType() with columnType in GetColumn * [AD-608] add check for optional values for log_msg * [AD-608] remove wasNull from JNI calls * remove wasNull parameter from JNI calls * remove wasNull parameter from resultSet calls * [AD-608] add if check for log_msg * add (*) operator for GetDataType, since dataType is a boost::optional variable * [AD-608] remove wasNull * wasNull is no longer required since we have nullable int/short/strings etc * remove references of wasNull in function calls * remove wasNull in DocumentDbDatabaseSchemaMetadataGetSchemaName * remove BOOST_CHECK / BOOST_REQUIRE for wasNull * add BOOST_CHECK for intValue in jni_test * [AD-608] bugfix make Nullability::ToSql always return * [AD-608] resolve build errors caused by boost::optional * add if statement checks that combine the initialization of the optional object and the test. * [AD-608] change decimalDigits to return a short * SQLColumns returns short for decimal digits on documentation * previously, unnecessary conversion from integer to short was done, so I've changed the SqlTypeDecimalDigits and the BinaryTypeDecimalDigits just to return shorts * [AD-608] call PutOpt* functions in type_info_query * [AD-608] re-add wasNull to DocumentDbDatabaseSchemaMetadataGetSchemaName * reason: it was a mistake to remove the wasNull in DocumentDbDatabaseSchemaMetadataGetSchemaName. * [AD-608] remove double const * [AD-608] update jni_test * fixed tests to check for correct boolean * changed test for char_octet_length since nullable ints are now supported * [AD-608] remove comments * [AD-608] bugfix BinaryTypeToSqlTypeName * change BinaryTypeToSqlTypeName to modify boost::optional< std::string >& value from returning a const boost::optional< std::string >, which caused issues. ** when returning boost::optional< std::string > to other spaces like column_metadata_query, the reference to the object is deleted because it is a boost::optional object. * I am considering replacing `void BinaryTypeToSqlTypeName` with ` const boost::optional< std::string >& BinaryTypeToSqlTypeName` altogether, but that's to be done for tomorrow * [AD-608] revert BinaryTypeToSqlTypeName back to returning an object * make BinaryTypeToSqlTypeName return boost::optional< std::string > instead of by reference (suggested by Bruce) * removed function "void BinaryTypeToSqlTypeName( boost::optional< int16_t > binaryType, boost::optional< std::string >& value)" because it is not needed Co-Authored-By: Bruce Irschick <[email protected]> * [AD-608] debug macOS build error * cast char[] to std::string * [AD-608] remove todo for wasNull(buffer_length_len) * [AD-608] add parameter for boost_check_equal * [AD-608] format java.h * [AD-608] refactor the format of result_set.h * [AD-608] remove extra line in application_data_buffer_.cpp * [AD-608] format result_set.cpp * [AD-608] reformat * [AD-608] reformat * remove comment * [AD-608] create NOTICE * [AD-608] update NOTICE to include line at end of file * [AD-608] update NOTICE from feedback Co-Authored-By: Alexey Temnikov <[email protected]> * [AD-608] test against local server * added new json file named meta_queries_test_002 for meta_queries_test. * add test TestGetDataWithColumnsReturnsOneFromLocalServer, which tests with meta_queries_test_002 * [AD-608] remove 'quiet' from import test data script * reason: it shows more details when imports are successful/fail. If we have 'quiet', we might not be able to know whether something has failed or not during the import of the test data. Co-Authored-By: Bruce Irschick <[email protected]> * [AD-608] remove --quiet in macOS import_test_data script * [AD-608] add back --quiet in macOS import_test_data script for clear database command * [AD-608] address code review comments * move boost::optional object initialization outside of if statement for readability. * [AD-608] remove unnecessary line in NOTICE * [AD-608] address code review comments and call get_value_or * call get_value_or to ensure log messages are always returned
- Loading branch information