Skip to content

Commit

Permalink
SNOW-1342953: read lob size from server parameter (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-hx authored Jul 26, 2024
1 parent 048dfdb commit f72b8b8
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 3 deletions.
10 changes: 9 additions & 1 deletion libsnowflakeclient/include/snowflake/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ extern "C" {
/**
* The maximum object size
*/
#define SF_MAX_OBJECT_SIZE 16777216
#define SF_MAX_OBJECT_SIZE SF_MACRO_DEPRECATED_WARNING("SF_MAX_OBJECT_SIZE is deprecated, please use snowflake_get_attribute() instead to retrieve the max LOB size.") 16777216

/**
* Login timeout in seconds
Expand Down Expand Up @@ -259,6 +259,9 @@ typedef enum SF_ATTRIBUTE {
SF_CON_INCLUDE_RETRY_REASON,
SF_CON_RETRY_TIMEOUT,
SF_CON_MAX_RETRY,
SF_CON_MAX_VARCHAR_SIZE,
SF_CON_MAX_BINARY_SIZE,
SF_CON_MAX_VARIANT_SIZE,
SF_DIR_QUERY_URL,
SF_DIR_QUERY_URL_PARAM,
SF_DIR_QUERY_TOKEN,
Expand Down Expand Up @@ -385,6 +388,11 @@ typedef struct SF_CONNECT {

// Error
SF_ERROR_STRUCT error;

// max lob size
uint64 max_varchar_size;
uint64 max_binary_size;
uint64 max_variant_size;
} SF_CONNECT;

/**
Expand Down
2 changes: 1 addition & 1 deletion libsnowflakeclient/include/snowflake/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
#ifndef SNOWFLAKE_CLIENT_VERSION_H
#define SNOWFLAKE_CLIENT_VERSION_H

#define SF_API_VERSION "1.0.12"
#define SF_API_VERSION "1.0.13"

#endif /* SNOWFLAKE_CLIENT_VERSION_H */
Binary file modified libsnowflakeclient/lib/darwin/libsnowflakeclient.a
Binary file not shown.
Binary file modified libsnowflakeclient/lib/linux/libsnowflakeclient.a
Binary file not shown.
Binary file modified libsnowflakeclient/lib/win64/vs16/snowflakeclient.lib
Binary file not shown.
4 changes: 3 additions & 1 deletion snowflake_stmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,16 @@ static int pdo_snowflake_stmt_describe(pdo_stmt_t *stmt, int colno) /* {{{ */
PDO_LOG_RETURN(0);
}
SF_COLUMN_DESC *F = snowflake_desc(S->stmt);
uint64* max_variant_size = NULL;
snowflake_get_attribute(S->stmt->connection, SF_CON_MAX_VARIANT_SIZE, (void**)&max_variant_size);
for (i = 0; i < stmt->column_count; i++) {
cols[i].precision = (zend_ulong) F[i].precision;
switch (F[i].type) {
case SF_DB_TYPE_OBJECT:
case SF_DB_TYPE_ARRAY:
case SF_DB_TYPE_VARIANT:
/* No size is given from the server */
cols[i].maxlen = SF_MAX_OBJECT_SIZE;
cols[i].maxlen = (size_t)(*max_variant_size);
break;
case SF_DB_TYPE_BOOLEAN:
cols[i].maxlen =
Expand Down

0 comments on commit f72b8b8

Please sign in to comment.