summaryrefslogtreecommitdiff
path: root/sql/sql_string.h
diff options
context:
space:
mode:
authorunknown <patg@patrick-galbraiths-computer.local>2004-11-12 15:56:25 -0800
committerunknown <patg@patrick-galbraiths-computer.local>2004-11-12 15:56:25 -0800
commit02840d1ba3ff75b5ada58807f69e0bff73b9599c (patch)
treed431ebbff8a72d8e8c79f066b2088b7463e4ca96 /sql/sql_string.h
parent10a15f6b34e4bf00fa17961e7a1bcb34e8c69c9e (diff)
downloadmariadb-git-02840d1ba3ff75b5ada58807f69e0bff73b9599c.tar.gz
Needed for WL# 2094, MySQL Federated Storage Handler
sql_string.h: simple string method to drop last character of a string (also decrements str_length) sql/sql_string.h: simple string method to drop last character of a string (also decrements str_length) BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql/sql_string.h')
-rw-r--r--sql/sql_string.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/sql/sql_string.h b/sql/sql_string.h
index cb5b1fb25fd..2101db40f92 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -141,6 +141,34 @@ public:
bool set(longlong num, CHARSET_INFO *cs);
bool set(ulonglong num, CHARSET_INFO *cs);
bool set(double num,uint decimals, CHARSET_INFO *cs);
+
+ /*
+ PMG 2004.11.12
+ This is a method that works the same as perl's "chop". It simply
+ drops the last character of a string. This is useful in the case
+ of the federated storage handler where I'm building a unknown
+ number, list of values and fields to be used in a sql insert
+ statement to be run on the remote server, and have a comma after each.
+ When the list is complete, I "chop" off the trailing comma
+
+ ex.
+ String stringobj;
+ stringobj.append("VALUES ('foo', 'fi', 'fo',");
+ stringobj.chop();
+ stringobj.append(")");
+
+ In this case, the value of string was:
+
+ VALUES ('foo', 'fi', 'fo',
+ VALUES ('foo', 'fi', 'fo'
+ VALUES ('foo', 'fi', 'fo')
+
+ */
+ inline void chop()
+ {
+ Ptr[str_length--]= '\0';
+ }
+
inline void free()
{
if (alloced)