mariadb/strings
Michael Widenius 5ab92b1f85 Adding support for Dynamic columns (WL#34):
- COLUMN_CREATE(column_nr, value, [column_nr,value]...)
- COLUMN_ADD(blob,column_nr, value, column_nr,value]...)
- COLUMN_DELETE(blob, column_nr, column_nr...)
- COLUMN_EXISTS(blob, column_nr)
- COLUMN_LIST(blob, column_nr)
- COLUMN_GET(string, column_nr AS type)

Added cast(X as DOUBLE) and cast(x as INT)
Better warning and error messages for wrong cast's
Created some sub functions to simplify and reuse code.
Added a lot of conversation functions with error/warnings for what went wrong.
Fixed some issues when casting time to datetime.
Added functions to dynamic strings and Strings to allow one to move a string buffer from dynamic strings to String (to save malloc+ copy)
Added dynamic columns library to libmysqlclient


include/Makefile.am:
  Added ma_dyncol.h
include/decimal.h:
  Added 'const' to arguments for some functions.
include/my_sys.h:
  Added dynstr_reassociate()
include/my_time.h:
  Added TIME_SUBSECOND_RANGE
  Added double_to_datetime()
  Added flag argument to str_to_time()
libmysql/CMakeLists.txt:
  Added mysys/ma_dyncol.c
libmysql/Makefile.shared:
  Added ma_dyncol
libmysql/libmysql.c:
  Added argument to str_to_time()
mysql-test/r/bigint.result:
  Better error messages
mysql-test/r/cast.result:
  Better warning and error messages
  A lot of new cast() tests
mysql-test/r/func_math.result:
  Better warning messages
mysql-test/r/func_str.result:
  Better warning messages
mysql-test/r/func_time.result:
  Better warning messages
mysql-test/r/sp-vars.result:
  Better warning messages
mysql-test/r/strict.result:
  Better warning messages
  New test result
mysql-test/r/type_newdecimal.result:
  Better warning messages
mysql-test/r/warnings.result:
  Better warning messages
mysql-test/suite/funcs_1/r/innodb_func_view.result:
  Updated results after better cast warnings
mysql-test/suite/funcs_1/r/memory_func_view.result:
  Updated results after better cast warnings
mysql-test/suite/funcs_1/r/myisam_func_view.result:
  Updated results after better cast warnings
mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test:
  Added begin...commit to speed up test.
mysql-test/suite/parts/inc/part_supported_sql_funcs_delete.inc:
  Added begin...commit to speed up test.
mysql-test/suite/parts/inc/partition_supported_sql_funcs.inc:
  Added begin...commit to speed up test.
mysql-test/suite/parts/r/part_supported_sql_func_innodb.result:
  Added begin...commit to speed up test.
mysql-test/suite/parts/r/part_supported_sql_func_myisam.result:
  Added begin...commit to speed up test.
mysql-test/suite/parts/r/rpl_partition.result:
  Added begin...commit to speed up test.
mysql-test/suite/parts/t/part_supported_sql_func_innodb.test:
  Removed duplicated --big_test
mysql-test/suite/parts/t/rpl_partition.test:
  Added begin...commit to speed up test.
mysql-test/suite/pbxt/r/cast.result:
  Updated results after better cast warnings
mysql-test/suite/pbxt/r/func_str.result:
  Updated results after better cast warnings
mysql-test/suite/pbxt/r/type_newdecimal.result:
  Updated results after better cast warnings
mysql-test/suite/rpl/r/rpl_innodb_bug28430.result:
  Added begin...commit to speed up test.
mysql-test/suite/rpl/t/rpl_innodb_bug28430.test:
  Added begin...commit to speed up test.
mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result:
  More warnings
mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result:
  More warnings
mysql-test/t/cast.test:
  A lot of new cast() tests
mysql-test/t/strict.test:
  Added new test
mysys/CMakeLists.txt:
  Added ma_dyncol.c
mysys/Makefile.am:
  Added ma_dyncol.c
mysys/string.c:
  Added dynstr_reassociate() to move a buffer from dynamic_strings to some other allocator
sql-common/my_time.c:
  Added 'fuzzydate' flag to str_to_time()
  Added support for microseconds to my_time_to_str() and my_datetime_to_str()
  Reset second_parts in number_to_datetime()
  Added double_to_datetime()
sql/field.cc:
  Added double_to_longlong() and truncate_double() to simplify and reuse code
sql/field.h:
  New prototypes
sql/item.cc:
  Changed Item::get_date(MYSQL_TIME *ltime,uint fuzzydate) to be aware of type of argument.
  (Needed to make it microsecond safe and get better warnings).
  Updated call to str_to_time_with_warn()
sql/item.h:
  Added struct st_dyncall_create_def used by dynamic columns
  Added virtual bool dynamic_result() to tell if type of argument may change over calls.
sql/item_cmpfunc.cc:
  Added Item_func_dyncol_exists()
sql/item_cmpfunc.h:
  Added class Item_func_dyncol_exists
sql/item_create.cc:
  Added get_length_and_scale() to simplify other functions
  Simplified and extended create_func_cast()
  Added support for cast(X as double(X,Y))
  Added functions to create dynamic column functions.
sql/item_create.h:
  Added prototypes
sql/item_func.cc:
  Extended cast functions Item_func_signed() and Item_func_unsigned() to work with dynamic types
  Added Item_double_typecast()
sql/item_func.h:
  Added class Item_double_typecast()
sql/item_strfunc.cc:
  Added functions for COLUMN_CREATE(), COLUMN_ADD(), COLUMN_GET() and COLUMN_LIST()
sql/item_strfunc.h:
  Added classes for COLUMN_CREATE(), COLUMN_ADD(), COLUMN_GET() and COLUMN_LIST()
sql/item_timefunc.cc:
  Added flag argument to str_to_time_with_warn()
  Updated Item_char_typecast() to handle result type that may change between calls (for dynamic columns)
  Added Item_time_typecast::get_date() to ensure that we cast a datetime to time properly.
sql/item_timefunc.h:
  Added get_date() to Item_time_typecast() to allow proper results for casting time to datetime
sql/lex.h:
  Added new SQL function names
sql/my_decimal.cc:
  Added 'const' to some arguments.
  Better error message in case of errors (we now print out the wrong value)
  Added my_decimal2int()
sql/my_decimal.h:
  Moved some constants to my_decimal_limits.h
  Updated prototypes.
  Made my_decimal2int() a function as it's rather long (no reason to have it inline)
  Added decimal2my_decimal() function.
sql/mysql_priv.h:
  Prototypes for new functions
sql/share/errmsg.txt:
  New error messages for wrong casts and dynamic columns
sql/sql_acl.cc:
  Fixed indentation
sql/sql_base.cc:
  Added dynamic_column_error_message()
sql/sql_string.h:
  Added reassociate() to move a buffer to be owned by String object.
sql/sql_yacc.yy:
  Added syntax for COLUMN_ functions.
sql/time.cc:
  Updated str_to_datetime_with_warn() flag argument to same type as other functions
  Added conversion flag to str_to_time_with_warn() (Similar to all datetime functions)
  Added conversion functions with warnings: double_to_datetime_with_warn() and decimal_to_datetime_with_warn()
strings/decimal.c:
  Added 'const' to arguments for some functions.
unittest/mysys/Makefile.am:
  Added test for dynamic columns code
2011-05-08 13:24:06 +03:00
..
.cvsignore
bchange.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
bcmp.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
bcopy-duff.c
bfill.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
bmove.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
bmove512.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
bmove_upp-sparc.s
bmove_upp.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
bzero.c Merge with MySQL 5.1.50 2010-08-27 17:12:44 +03:00
ChangeLog
CHARSET_INFO.txt Bug #49752: 2469.126.2 unintentionally breaks authentication against 2010-11-11 07:34:14 +00:00
CMakeLists.txt MWL#55 : cherrypick MySQL 5.5 CMake/build improvements in order 2011-01-29 18:51:12 +01:00
conf_to_src.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype-big5.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype-bin.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype-cp932.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype-czech.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype-euc_kr.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype-eucjpms.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype-extra.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype-gb2312.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype-gbk.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype-latin1.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype-mb.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype-simple.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype-sjis.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype-tis620.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype-uca.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype-ucs2.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype-ujis.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype-utf8.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype-win1250ch.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ctype.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
decimal.c Adding support for Dynamic columns (WL#34): 2011-05-08 13:24:06 +03:00
do_ctype.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
dump_map.c
int2str.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
is_prefix.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
latin2.def
llstr.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
longlong2str-x86.s
longlong2str.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
longlong2str_asm.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
macros.asm
make-ccc Bug#53445: Build with -Wall and fix warnings that it generates 2010-07-02 15:30:47 -03:00
Makefile.am Added missing header file strings_def.h to dist 2011-02-03 16:03:54 +02:00
memcmp.c
memcpy.c
memset.c
my_strchr.c Merge with MySQL 5.1.55 2011-02-20 18:51:43 +02:00
my_strtoll10-x86.s
my_strtoll10.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
my_vsnprintf.c Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
ptr_cmp.asm
r_strinstr.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
README
str2int.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
str_alloc.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
str_test.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strappend-sparc.s
strappend.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strcat.c
strcend.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strchr.c
strcmp.c
strcont.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strend-sparc.s
strend.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strfill.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
string.doc
strings-not-used.h
strings-x86.s
strings.asm
strings_def.h Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strinstr-sparc.s
strinstr.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strlen.c
strmake-sparc.s
strmake.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strmov-sparc.s
strmov.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strmov_overlapp.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strnlen.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strnmov-sparc.s
strnmov.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strrchr.c
strstr-sparc.s
strstr.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strto.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strtod.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strtol.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strtoll.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strtoul.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strtoull.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strxmov-sparc.s
strxmov.asm
strxmov.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
strxnmov.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
t_ctype.h
uca-dump.c
uctypedump.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
udiv.c Flush DBUG log in case of DBUG_ASSERT() 2011-01-30 12:41:44 +02:00
utr11-dump.c
xml.c Merge with 5.1 2011-01-30 16:43:23 +02:00

File   : README
Author : Richard A. O'Keefe.
Updated: 30 April 1984
Purpose: Explain the new strings package.

    The UNIX string libraries (described in the string(3) manual page)
differ from UNIX to UNIX (e.g. strtok is not in V7 or 4.1bsd).  Worse,
the sources are not in the public domain, so that if there is a string
routine which is nearly what you want but not quite you can't  take  a
copy  and  modify it.  And of course C programmers on non-UNIX systems
are at the mercy of their supplier.

    This package was designed to let me do reasonable things with  C's
strings  whatever UNIX (V7, PaNiX, UX63, 4.1bsd) I happen to be using.
Everything in the System III manual is here and does just what the  S3
manual  says  it does.  There are also lots of new goodies.  I'm sorry
about the names, but the routines do have to work  on  asphyxiated-at-
birth  systems  which  truncate identifiers.  The convention is that a
routine is called
 str [n] [c] <operation>
If there is an "n", it means that the function takes an (int) "length"
argument, which bounds the number of characters to be moved or  looked
at.  If the function has a "set" argument, a "c" in the name indicates
that  the complement of the set is used.  Functions or variables whose
names start with _ are support routines which aren't really meant  for
general  use.  I don't know what the "p" is doing in "strpbrk", but it
is there in the S3 manual so it's here too.  "istrtok" does not follow
this rule, but with 7 letters what can you do?

    I have included new versions of atoi(3) and atol(3) as well.  They
use a new primitive str2int, which takes a pair of bounds and a radix,
and does much more thorough checking than the normal atoi and atol do.
The result returned by atoi & atol is valid if and only if errno == 0.
There is also an output conversion routine int2str, with itoa and ltoa
as interface macros.  Only after writing int2str did I notice that the
str2int routine has no provision for unsigned numbers.  On reflection,
I don't greatly care.   I'm afraid that int2str may depend on your "C"
compiler in unexpected ways.  Do check the code with -S.

    Several of these routines have "asm" inclusions conditional on the
VaxAsm option.  These insertions can make the routines which have them
quite a bit faster, but there is a snag.  The VAX architects, for some
reason best known to themselves and their therapists, decided that all
"strings" were shorter than 2^16 bytes.  Even when the length operands
are in 32-bit registers, only 16 bits count.  So the "asm" versions do
not work for long strings.  If you can guarantee that all your strings
will be short, define VaxAsm in the makefile, but in general, and when
using other machines, do not define it.

    To use this library, you need the "strings.a" library file and the
"strings.h" and "ctypes.h" header files.  The other header  files  are
for compiling the library itself, though if you are hacking extensions
you  may  find  them useful.  General users really shouldn't see them.
I've defined a few macros I find useful in "strings.h"; if you have no
need for "index", "rindex", "streql", and "beql", just edit them  out.
On the 4.1bsd system I am using declaring all these functions 'extern'
does not mean that they will all be loaded; but only the ones you use.
When using lesser systems you may find it necessary to break strings.h
up, or you could get by with just adding "extern" declarations for the
functions you want as you need them.  Many of these functions have the
same names as functions in the "standard C library", by design as this
is a replacement/reimplementation of part of that library.  So you may
have to talk the loader into loading this library first.   Again, I've
found no problems on 4.1bsd.

    You may wonder at my failure to provide manual pages for this code.
For the things in V7, 4.?, or SIII, you should be able to use whichever
manual page came with that system,  and anything I might write would be
so like it as to raise suspicions of violating AT&T copyrights.  In the
sources you will find comments which provide far more documentation for
these routines than AT&T ever provided for their strings stuff,  I just
don't happen to have put it in nroff -man form.   Had I done so, the .3
files would have outbulked the .c files!

    These files are in the public domain.  This includes getopt.c, which
is the work of Henry Spencer, University of Toronto Zoology, who says of
it "None of this software is derived from Bell software. I had no access
to the source for Bell's versions at the time I wrote it.  This software
is hereby explicitly placed in the public domain.  It may  be  used  for
any purpose on any machine by anyone." I would greatly prefer it if *my*
material received no military use.