-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new test case to replicate customer issue where a query is exec…
…uted on Snowflake and the C API gets an empty response. Added error propagation for the case where we get an empty JSON response from the server. Fixed some white space issues in connection.c
- Loading branch information
1 parent
a725c01
commit 0773c87
Showing
4 changed files
with
68 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ SET(TESTS_C | |
test_timestamp_tz | ||
test_timezone | ||
test_adjust_fetch_data | ||
test_issue_76 | ||
) | ||
|
||
SET(TESTS_CXX | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) 2017-2018 Snowflake Computing, Inc. All rights reserved. | ||
*/ | ||
|
||
#include <string.h> | ||
#include "utils/test_setup.h" | ||
|
||
void test_issue_76(void **unused) { | ||
SF_CONNECT *sf = setup_snowflake_connection(); | ||
SF_STATUS status = snowflake_connect(sf); | ||
if (status != SF_STATUS_SUCCESS) { | ||
dump_error(&(sf->error)); | ||
} | ||
assert_int_equal(status, SF_STATUS_SUCCESS); | ||
|
||
/* query */ | ||
SF_STMT *sfstmt = snowflake_stmt(sf); | ||
status = snowflake_prepare(sfstmt, "CREATE OR REPLACE TABLE obfuscated_table_name (daily_input number(38,6))", 0); | ||
if (status != SF_STATUS_SUCCESS) { | ||
dump_error(&(sfstmt->error)); | ||
} | ||
|
||
status = snowflake_execute(sfstmt); | ||
if (status != SF_STATUS_SUCCESS) { | ||
dump_error(&(sfstmt->error)); | ||
} | ||
assert_int_equal(status, SF_STATUS_SUCCESS); | ||
assert_int_equal(1, sfstmt->total_fieldcount); | ||
|
||
snowflake_stmt_term(sfstmt); | ||
snowflake_term(sf); | ||
} | ||
|
||
int main(void) { | ||
initialize_test(SF_BOOLEAN_FALSE); | ||
const struct CMUnitTest tests[] = { | ||
cmocka_unit_test(test_issue_76), | ||
}; | ||
int ret = cmocka_run_group_tests(tests, NULL, NULL); | ||
snowflake_global_term(); | ||
return ret; | ||
} |