Commit graph

155 commits

Author SHA1 Message Date
df@pippilotta.erinye.com
f0f9652988 Merge pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.1
into  pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.1-build
2007-08-04 11:08:11 +02:00
bar@bar.myoffice.izhnet.ru
fb8dff9721 Merge mysql.com:/home/bar/mysql-work/mysql-5.0.b28875
into  mysql.com:/home/bar/mysql-work/mysql-5.1.b28875
2007-08-03 17:16:02 +05:00
bar@mysql.com/bar.myoffice.izhnet.ru
4eebfd09c2 Bug#28875 Conversion between ASCII and LATIN1 charsets does not function
(Regression, caused by a patch for the bug 22646).
Problem: when result type of date_format() was changed from
binary string to character string, mixing date_format()
with a ascii column in CONCAT() stopped to work.
Fix:
- adding "repertoire" flag into DTCollation class,
to mark items which can return only pure ASCII strings.
- allow character set conversion from pure ASCII to other character sets.
2007-08-03 15:25:23 +05:00
monty@mysql.com/nosik.monty.fi
b16289a5e0 Slow query log to file now displays queries with microsecond precission
--long-query-time is now given in seconds with microseconds as decimals
--min_examined_row_limit added for slow query log
long_query_time user variable is now double with 6 decimals
Added functions to get time in microseconds
Added faster time() functions for system that has gethrtime()  (Solaris)
We now do less time() calls.
Added field->in_read_set() and field->in_write_set() for easier field manipulation by handlers
set_var.cc and my_getopt() can now handle DOUBLE variables.
All time() calls changed to my_time()
my_time() now does retry's if time() call fails.
Added debug function for stopping in mysql_admin_table() when tables are locked
Some trivial function and struct variable renames to avoid merge errors.
Fixed compiler warnings
Initialization of some time variables on windows moved to my_init()
2007-07-30 11:33:50 +03:00
anozdrin/alik@ibm.
9fae9ef66f Patch for the following bugs:
- BUG#11986: Stored routines and triggers can fail if the code
    has a non-ascii symbol
  - BUG#16291: mysqldump corrupts string-constants with non-ascii-chars
  - BUG#19443: INFORMATION_SCHEMA does not support charsets properly
  - BUG#21249: Character set of SP-var can be ignored
  - BUG#25212: Character set of string constant is ignored (stored routines)
  - BUG#25221: Character set of string constant is ignored (triggers)

There were a few general problems that caused these bugs:
1. Character set information of the original (definition) query for views,
   triggers, stored routines and events was lost.
2. mysqldump output query in client character set, which can be
   inappropriate to encode definition-query.
3. INFORMATION_SCHEMA used strings with mixed encodings to display object
   definition;

1. No query-definition-character set.

In order to compile query into execution code, some extra data (such as
environment variables or the database character set) is used. The problem
here was that this context was not preserved. So, on the next load it can
differ from the original one, thus the result will be different.

The context contains the following data:
  - client character set;
  - connection collation (character set and collation);
  - collation of the owner database;

The fix is to store this context and use it each time we parse (compile)
and execute the object (stored routine, trigger, ...).

2. Wrong mysqldump-output.

The original query can contain several encodings (by means of character set
introducers). The problem here was that we tried to convert original query
to the mysqldump-client character set.

Moreover, we stored queries in different character sets for different
objects (views, for one, used UTF8, triggers used original character set).

The solution is
  - to store definition queries in the original character set;
  - to change SHOW CREATE statement to output definition query in the
    binary character set (i.e. without any conversion);
  - introduce SHOW CREATE TRIGGER statement;
  - to dump special statements to switch the context to the original one
    before dumping and restore it afterwards.

Note, in order to preserve the database collation at the creation time,
additional ALTER DATABASE might be used (to temporary switch the database
collation back to the original value). In this case, ALTER DATABASE
privilege will be required. This is a backward-incompatible change.

3. INFORMATION_SCHEMA showed non-UTF8 strings

The fix is to generate UTF8-query during the parsing, store it in the object
and show it in the INFORMATION_SCHEMA.

Basically, the idea is to create a copy of the original query convert it to
UTF8. Character set introducers are removed and all text literals are
converted to UTF8.

This UTF8 query is intended to provide user-readable output. It must not be
used to recreate the object.  Specialized SHOW CREATE statements should be
used for this.

The reason for this limitation is the following: the original query can
contain symbols from several character sets (by means of character set
introducers).

Example:

  - original query:
    CREATE VIEW v1 AS SELECT _cp1251 'Hello' AS c1;

  - UTF8 query (for INFORMATION_SCHEMA):
    CREATE VIEW v1 AS SELECT 'Hello' AS c1;
2007-06-28 21:34:54 +04:00
tsmith@maint1.mysql.com
8ee2c2b04e Merge maint1.mysql.com:/data/localhome/tsmith/bk/maint/50
into  maint1.mysql.com:/data/localhome/tsmith/bk/maint/51
2007-06-21 20:55:37 +02:00
anozdrin/alik@ibm.
62e3e46275 This the 4-th patch in scope of CS patch (BUG#11986).
The patch contains the following changes:
  - Introduce auxilary functions to convenient work with character sets:
    - resolve_charset();
    - resolve_collation();
    - get_default_db_collation();
  - Introduce lex_string_set();
  - Refactor Table_trigger_list::process_triggers() &
    sp_head::execute_trigger() to be consistent with other code;
  - Move reusable code from add_table_for_trigger() into
    build_trn_path(), check_trn_exists() and load_table_name_for_trigger()
    to be used in the following patch.
  - Rename triggers_file_ext and trigname_file_ext into TRN_EXT and
    TRG_EXT respectively.
2007-06-14 19:23:55 +04:00
bar@mysql.com/bar.myoffice.izhnet.ru
d3c4f1b22b Bug#28916 LDML doesn't work for utf8
and is not described in the manual
- Adding missing initialization for utf8 collations
- Minor code clean-ups: renaming variables,
  moving code into a new separate function.
- Adding test, to check that both ucs2 and utf8 user
  defined collations work (ucs2_test_ci and utf8_test_ci)
- Adding Vietnamese collation as a complex user defined
  collation example.
2007-06-07 17:55:55 +05:00
monty@mysql.com/narttu.mysql.fi
088e2395f1 WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:

- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t

Removed declaration of byte, gptr, my_string, my_size_t and size_s. 

Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
  instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
  as this requires fewer casts in the code and is more in line with how the
  standard functions work.
- Added extra length argument to dirname_part() to return the length of the
  created string.
- Changed (at least) following functions to take uchar* as argument:
  - db_dump()
  - my_net_write()
  - net_write_command()
  - net_store_data()
  - DBUG_DUMP()
  - decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
  argument to my_uncompress() from a pointer to a value as we only return
  one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
  the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
  casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.

Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
  needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
  explicitely as this conflict was often hided by casting the function to
  hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
  get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
  size_t. This was needed to properly detect errors (which are
  returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
  (portability fix)
- Removed windows specific code to restore cursor position as this
  causes slowdown on windows and we should not mix read() and pread()
  calls anyway as this is not thread safe. Updated function comment to
  reflect this. Changed function that depended on original behavior of
  my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
  m_size is the number of elements in the array, not a string/memory
  length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
  Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
  - Replaced some calls to alloc_root + memcpy to use
    strmake_root()/strdup_root().
  - Changed some calls from memdup() to strmake() (Safety fix)
  - Simpler loops in client-simple.c
2007-05-10 12:59:39 +03:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
e62dbcf746 Fix for
bug #27715: mysqld --character-sets-dir buffer overflow
bug ##26851: Mysql Client --pager Buffer Overflow

Using strmov() to copy an argument may cause overflow 
if the argument's length is bigger than the buffer:
use strmake instead.
Also, we have to encrease the error message buffer size to fit 
the longest message.
2007-04-16 12:28:02 +05:00
kent@mysql.com/kent-amd64.(none)
226a5c833f Many files:
Changed header to GPL version 2 only
2006-12-23 20:17:15 +01:00
tsmith/tim@siva.hindu.god
fb6625e495 Merge siva.hindu.god:/usr/home/tim/m/bk/tmp/41
into  siva.hindu.god:/usr/home/tim/m/bk/tmp/50
2006-09-14 23:22:25 -06:00
tsmith/tim@siva.hindu.god
5ec2bfe94c Bug #4053: too many of "error 1236: 'binlog truncated in the middle of event' from master"
- Detect read failure in my_read_charset_file
2006-09-14 21:06:14 -06:00
bar@mysql.com
6c258beb2d Merge mysql.com:/usr/home/bar/mysql-4.1
into  mysql.com:/usr/home/bar/mysql-5.0
2005-10-20 11:12:34 +05:00
bar@mysql.com
af3d8bd4ad charset.c:
Bug#13238 mysqldump and mysqladmin hangs
  Avoid recursion into init_available_charsets.
  Serg's version didn't work for me: I got 
  double mutex locking.
  Pushing this version instead
  (It was approved by Serg anyway)
2005-10-20 10:30:51 +05:00
jani@a193-229-222-105.elisa-laajakaista.fi
7b7188cea6 Merge a193-229-222-105.elisa-laajakaista.fi:/home/my/bk/mysql-4.1
into  a193-229-222-105.elisa-laajakaista.fi:/home/my/bk/mysql-5.0
2005-08-26 15:56:52 +03:00
monty@mishka.local
6773d24704 Remove function that was accidently added back 2005-08-25 09:03:41 +03:00
kent@mysql.com
4d2cc6e503 Merge 2005-08-23 18:06:24 +02:00
elliot@mysql.com
d9efe655ed Bug#11338 Fixes from review (identical functionality). 2005-08-19 14:49:34 -04:00
joerg@mysql.com
ecf4068fff No C++ style comments in C source! 2005-08-17 15:11:29 +02:00
elliot@mysql.com
197782605f BUG#11338 (logging of prepared statement w/ blob type)
In cp932, '\' character can be the second byte in a 
multi-byte character stream. This makes it difficult to use
mysql_escape_string. Added flag to indicate which languages allow
'\' as second byte of multibyte sequence so that when putting a prepared
statement into the binlog we can decide at runtime whether hex encoding
is really needed.
2005-08-17 04:26:32 -04:00
acurtis@xiphis.org
b9476f7d50 Merge xiphis.org:/usr/home/antony/work2/mysql-4.1
into  xiphis.org:/usr/home/antony/work2/merge-5.0
2005-08-11 12:18:53 +01:00
bar@mysql.com
281c8ec163 Bug#5439 : mysql_server_init() crashes if ShiftJIS path is passed
(important for Adobe).

mf_pack.c, mf_dirname.c, charset.c, my_sys.h:

  - adding fs_character_set() function on Windows
  - ignoring fake slashes which are just multibyte
    parts in several functions in /mysys

Verified by Shu to work on WinXP and Win2k.
Test is not possible, or very hard to do.
2005-08-08 19:52:30 +05:00
monty@mysql.com
b3cbd0048f Cleanups during review of new code
Ensure mysql_close() is called if mysql_set_character_set() fails
2005-07-28 16:10:14 +03:00
bar@mysql.com
bfe8ba7de7 Merge mysql.com:/usr/home/bar/mysql-4.1
into  mysql.com:/usr/home/bar/mysql-5.0
2005-07-26 17:53:18 +05:00
bar@mysql.com
975b4969a5 charset.c:
Bug#12109 possible locking bug in init_available_charset
  Recheck charset_initialized inside locked code,
  to garantee two threads are not entering
  consequently.
2005-07-25 21:34:20 +05:00
jimw@mysql.com
de55960430 Add documentation to the escape_*() functions in mysys. 2005-07-05 09:45:32 -07:00
jimw@mysql.com
3ccb90c085 Make status of NO_BACKSLASH_ESCAPES mode known to the client so
it can use it to switch to only quoting apostrophes by doubling
them when it is in effect. (Bug #10214)
2005-06-23 18:29:56 -07:00
ramil@mysql.com
22646589b6 a fix (bug #10650: Bit literal case sensitivity). 2005-06-16 12:17:15 +05:00
ramil@mysql.com
7882cd32bc A fix (bug #9756: mysql client failing on dumps containing certain \ sequences). 2005-04-26 15:43:20 +05:00
serg@serg.mylan
376a4ee03b Field::quote_data():
don't call escape_string_for_mysql() unnecesary
  don't overwrite local buffer
escape_string_for_mysql():
  take a length of the destination buffer as an argument
2005-03-17 12:27:45 +01:00
bar@mysql.com
5ef265f219 Bug#8349 myisamchk: --set-charset does not work
What we need to be able to set in myisamchk is
actually a collation, not a character set. This
fix just changes to display the proper error message.
2005-02-22 16:37:25 +04:00
bar@mysql.com
c0230f6f5f ctype_latin1.result, ctype_latin1.test, charset.c:
Treat unknown characters straight in a query as syntax error, rather skipping it as a space character.
2005-02-22 09:56:07 +04:00
bar@mysql.com
c926e43f65 A way not to compile UCA collations 2005-02-18 12:58:16 +04:00
jimw@mysql.com
e2291bdc7e Only escape the first character in a sequence of bytes that appears to be
a multibyte character, but was not a valid multibyte character. Refinement
of fix for Bug #8378.
2005-02-15 11:31:01 -08:00
jimw@mysql.com
5bb39302ab When escaping a string in a multi-byte character set, escape all bytes of
a character that appears to be a multi-byte character based on its first
byte, but is not actually a valid multi-byte character. (Bug #8378)
2005-02-09 16:14:13 -08:00
bar@mysql.com
e3b94d4ef5 Bug #6737: REGEXP gives wrong result with case sensitive collation:
- A new flag MY_CS_CSSORT was introduced for case sensitivity.
- Item_func_regexp doesn't substiture ICASE not only
  for binary collations but for case sensitive collations as well.
2004-11-22 11:58:40 +04:00
bar@mysql.com
f814d224f7 Critical fixes after review:
- mutex was unlocked before the end of the critical sesion,
- Portability issue: It's better to use (*alloc)(x) instead of alloc(x),
  if alloc is a function passed as an argument.
- Use {} around if() block, to avoid possible problems with some Windows compilers.
2004-06-16 19:06:45 +05:00
bar@mysql.com
fc7ba0885e Move UCA language specific definitions into ctype-ucs.c. 2004-06-11 19:16:06 +05:00
bar@mysql.com
53a7bd5931 charset.c:
Reuse some code between simple and UCA collations.
2004-06-11 18:25:50 +05:00
bar@mysql.com
f8b15e8bb6 Initialize max_sort_char only if a character set is requested. 2004-06-11 17:50:20 +05:00
bar@mysql.com
c64d93b274 Allocate memory when a character set is requested:
- For simple character sets: from_uni convertion table.
- For UCA: alternative weight arrays.
Use mbminlen instead of MY_CS_NONTEXT
2004-06-11 16:29:16 +05:00
bar@mysql.com
34d413a6a0 Optimization to use less memory. 2004-06-10 19:10:21 +05:00
bar@mysql.com
1b76aa077f charset.c:
Fix to be ANSI C complient
  ,
2004-06-09 12:33:30 +05:00
bar@bar.intranet.mysql.r18.ru
8962ed3c7d WL#916: Unicode collations for some languages 2004-06-08 17:56:15 +05:00
bar@bar.intranet.mysql.r18.ru
3f556025a7 charset.c:
Typo fix.
  Thanks Vladimir Kolpakov who noticed it.
2004-06-04 09:07:46 +05:00
bar@bar.intranet.mysql.r18.ru
23aee5621d Unicode collations: WL#916
XML and "collation customization" language parsers.
2004-06-03 17:45:53 +05:00
bar@bar.intranet.mysql.r18.ru
391d5629f6 Preparation for user-defined Unicode collations:
weights data now comes from a static variables
but from the charset structure.
2004-05-25 17:40:20 +05:00
konstantin@mysql.com
f207b33a7b Support for character set conversion in binary protocol: another go
after Monty's review.
- Item_param was rewritten.
- it turns out that we can't convert string data to character set of
  connection on the fly, because they first should be written to the binary
  log.
  To support efficient conversion we need to rewrite prepared statements
  binlogging code first.
2004-05-25 02:03:49 +04:00
sergefp@mysql.com
cc2eb9d5c3 Renamed MY_LEX_COLON to MY_LEX_SEMICOLON (at Serg's request) 2004-04-28 01:49:05 +04:00