summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2004-12-18 00:17:25 +0300
committerunknown <konstantin@mysql.com>2004-12-18 00:17:25 +0300
commit996352b73e60cce2458cf72ab36c49126e635997 (patch)
tree75100b91f7d8e8ab02c6fa3120b8fbb75d8e7265 /sql-common
parent91a76445335eb251440e61b114b4fdbb0dba5813 (diff)
downloadmariadb-git-996352b73e60cce2458cf72ab36c49126e635997.tar.gz
Truncations patch: a post-review fix.
include/mysql.h: Adding an option for data truncations feature. libmysql/libmysql.c: No 'smart' behaviour now for data truncations: they are always reported, unless switched off with mysql_options(mysql, MYSQL_REPORT_DATA_TRUNCATION, (my_bool*) &(option=1)); sql-common/client.c: Add support for report-data-truncation variable in my.cnf tests/client_test.c: A test for MYSQL_REPORT_DATA_TRUNCATION option.
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/client.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index fd65ed01462..1a9bc4221a0 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -874,6 +874,7 @@ static const char *default_options[]=
"replication-probe", "enable-reads-from-master", "repl-parse-query",
"ssl-cipher", "max-allowed-packet", "protocol", "shared-memory-base-name",
"multi-results", "multi-queries", "secure-auth",
+ "report-data-truncation",
NullS
};
@@ -1084,6 +1085,9 @@ void mysql_read_default_options(struct st_mysql_options *options,
case 32: /* secure-auth */
options->secure_auth= TRUE;
break;
+ case 33: /* report-data-truncation */
+ options->report_data_truncation= opt_arg ? test(atoi(opt_arg)) : 1;
+ break;
default:
DBUG_PRINT("warning",("unknown option: %s",option[0]));
}
@@ -1427,6 +1431,7 @@ mysql_init(MYSQL *mysql)
#endif
mysql->options.methods_to_use= MYSQL_OPT_GUESS_CONNECTION;
+ mysql->options.report_data_truncation= TRUE; /* default */
return mysql;
}
@@ -2666,6 +2671,9 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg)
case MYSQL_SECURE_AUTH:
mysql->options.secure_auth= *(my_bool *) arg;
break;
+ case MYSQL_REPORT_DATA_TRUNCATION:
+ mysql->options.report_data_truncation= test(*(my_bool *) arg);
+ break;
default:
DBUG_RETURN(1);
}