Oracle 5.0 Reference Manual page 1946

Table of Contents

Advertisement

Treating Binary Blobs As UTF8
MySQL doesn't currently support 4-byte UTF8 sequences. This makes it difficult to represent some
multi-byte languages such as Japanese. To try and alleviate this, Connector/Net now supports a mode
where binary blobs can be treated as strings.
To do this, you set the
all that needs to be done to enable conversion of all binary blobs to UTF8 strings. To convert
only some of your BLOB columns, you can make use of the
and'BlobAsUTF8ExcludePattern'
matches the column names to include or exclude respectively.
When the regular expression patterns both match a single column, the include pattern is applied before
the exclude pattern. The result, in this case, would be that the column would be excluded. Also, be
aware that this mode does not apply to columns of type
to nonbinary
Currently, this mode only applies to reading strings out of MySQL. To insert 4-byte UTF8 strings into
blob columns, use the .NET
You can then set this byte array as a parameter for a
20.2.5.17. Using Connector/Net with Crystal Reports
Crystal Reports is a common tool used by Windows application developers to perform reporting and
document generation. In this section we will show how to use Crystal Reports XI with MySQL and
Connector/Net.
20.2.5.17.1. Creating a Data Source
When creating a report in Crystal Reports there are two options for accessing the MySQL data while
designing your report.
The first option is to use Connector/ODBC as an ADO data source when designing your report. You will
be able to browse your database and choose tables and fields using drag and drop to build your report.
The disadvantage of this approach is that additional work must be performed within your application to
produce a data set that matches the one expected by your report.
The second option is to create a data set in VB.NET and save it as XML. This XML file can then be
used to design a report. This works quite well when displaying the report in your application, but is less
versatile at design time because you must choose all relevant columns when creating the data set. If
you forget a column you must re-create the data set before the column can be added to the report.
The following code can be used to create a data set from a query and write it to disk:
Visual Basic Example
Dim myData As New DataSet
Dim conn As New MySqlConnection
Dim cmd As New MySqlCommand
Dim myAdapter As New MySqlDataAdapter
conn.ConnectionString = "server=127.0.0.1;" _
& "uid=root;" _
& "pwd=12345;" _
& "database=world"
Try
conn.Open()
cmd.CommandText = "SELECT city.name AS cityName, city.population AS CityPopulation, " _
& "country.name, country.population, country.continent " _
& "FROM country, city ORDER BY country.continent, country.name"
cmd.Connection = conn
Connector/Net Programming
'Treat Blobs As UTF8'
columns.
BLOB
Encoding.GetBytes
connection string keyword to yes. This is
'BlobAsUTF8IncludePattern'
keywords. Set these to a regular expression pattern that
BINARY
function to convert your string to a series of bytes.
column.
BLOB
1926
or
and also do not apply
VARBINARY

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents