bin/php/ezconvertdbcharset.php

Show: inherited
Table of Contents

File containing the ezconvertdbcharset.php script.

Copyright
Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.  
License
eZ Business Use License Agreement Version 2.0  
Package
kernel  
Version
4.6.0  

Constants

Constant  EZ_CONTENTCLASS_ATTRIBUTE_TMP_TABLE_NAME = 'ezcontentclass_attribute_tmp'
Constant  EZ_CREATE_CONTENTCLASS_ATTRIBUTE_TMP_TABLE_SQL_MYSQL = " CREATE TEMPORARY TABLE " . EZ_CONTENTCLASS_ATTRIBUTE_TMP_TABLE_NAME . " ( id int(11) NOT NULL default '0', version int(11) NOT NULL default '0', is_always_available int(11) NOT NULL default '0', language_locale varchar(20) NOT NULL default '', name varchar(255) NOT NULL default '', PRIMARY KEY (id,version,language_locale) )"
Constant  EZ_CREATE_CONTENTCLASS_ATTRIBUTE_TMP_TABLE_SQL_POSTGRESQL = " CREATE TABLE " . EZ_CONTENTCLASS_ATTRIBUTE_TMP_TABLE_NAME . " ( id integer DEFAULT 0 NOT NULL, version integer DEFAULT 0 NOT NULL, is_always_available integer DEFAULT 0 NOT NULL, language_locale character varying(20) DEFAULT ''::character varying NOT NULL, name character varying(255) DEFAULT ''::character varying NOT NULL )"
Constant  EZ_CREATE_CONTENTCLASS_ATTRIBUTE_TMP_TABLE_SQL_ORACLE = " CREATE GLOBAL TEMPORARY TABLE " . EZ_CONTENTCLASS_ATTRIBUTE_TMP_TABLE_NAME . " ( id number(11) DEFAULT 0 NOT NULL, version number(11) DEFAULT 0 NOT NULL, is_always_available number(11) DEFAULT 0 NOT NULL, language_locale varchar2(20) NOT NULL, name varchar2(255) NOT NULL ) ON COMMIT PRESERVE ROWS;"
Constant  EZ_DROP_CONTENTCLASS_ATTRIBUTE_TMP_TABLE_SQL = "DROP TABLE " . EZ_CONTENTCLASS_ATTRIBUTE_TMP_TABLE_NAME

Functions

functionchangeDBCharset(  $charset,  $collation ) : void

Parameters
Name Type Description
$charset
$collation
functionchangeDBCharsetMYSQL(  $charset,  $collation ) : void

Parameters
Name Type Description
$charset
$collation
functionchangeDBCharsetORACLE(  $charset,  $collation ) : void

NOTE: What if other data is also in the db? Either we do not convert it and have it most likely corrupted, or we convert it - and leave to the client for the other apps to set up NLS_LANG correctly to keep working.

We could use the csalter script iff we where sure that db version was > 9...

  Oracle 9 exp exports data using the DB charset

From http://www.experts-exchange.com/Database/Oracle/Q_22836430.html

May be the best procedure is the following one: On PROD Database: 1. export full=y rows=n file=export_db_structure.dmp 2. export full=y file=export_db_date.dmp On TEST Database: 1. create tablespaces with the same name on PROD 2. import full=y file=export_db_structure.dmp ignore=y Now we have users of PROD, on TEST database. SYSTEM user is not imported, because already exists. 3. import fromuser=user1,user2,user3 touser=user1,user2,user3 file=export_db_data.dmp ignore=y now we have user1..3 data on their tables...

  Unfortunately even if we do that, Oracle will nto let us convert a db from
  latin1 to utf8 charsets. The only way is to drop the db and creater it
  from scratch. Since we have no clue about db storage, we will let the admin
  take care of that part, and only do the export/import parts.
Parameters
Name Type Description
$charset
$collation
Details
Todo
oracle servers might use UTF8 charset instead of AL32UTF8: check before executing!  
Todo
using dbname as file name does not work with easy conection naming  
Todo
log somewhere results of imp, exp commands for better understanding of errors  
functionchangeDBCharsetPOSTGRESQL(  $charset,  $collation ) : void

Parameters
Name Type Description
$charset
$collation
functioncheckDBCharset(  $iconvCharacterSet ) : void

Parameters
Name Type Description
$iconvCharacterSet
functioncheckDBDriver( ) : void

functioncheckDBExtraConditions( ) : void

functioncheckDBExtraConditionsORACLE( ) : void

functionconvertArray(  $array,  $inCharset,  $outCharset ) : void

Parameters
Name Type Description
$array
$inCharset
$outCharset
functionconvertCustomXMLData(  $tableInfoList ) : void

Parameters
Name Type Description
$tableInfoList
functionconvertSerializedData(  $serializedDataInfo ) : void

Parameters
Name Type Description
$serializedDataInfo
functionconvertXMLCustomDataProgress(  $row ) : void

Parameters
Name Type Description
$row
functionconvertXMLData(  $tableInfo,  $xmlDataSelectSQLFunction,  $xmlDataUpdateSQLFunction,  $convertXMLProgressFunction ) : void

Parameters
Name Type Description
$tableInfo
$xmlDataSelectSQLFunction
$xmlDataUpdateSQLFunction
$convertXMLProgressFunction
functionconvertXMLDatatypeProgress(  $row ) : void

Parameters
Name Type Description
$row
functionconvertXMLDatatypes(  $tableInfoList ) : void

Parameters
Name Type Description
$tableInfoList
functioncreateBLOBColumnMYSQL(  $tableInfo ) : void

Parameters
Name Type Description
$tableInfo
functioncreateBLOBColumnORACLE(  $tableInfo ) : void

Parameters
Name Type Description
$tableInfo
functioncreateBLOBColumnPOSTGRESQL(  $tableInfo ) : void

Parameters
Name Type Description
$tableInfo
functioncreateContentClassAttributeTempTable( ) : void

functiondropBLOBColumn(  $tableInfo ) : void

Parameters
Name Type Description
$tableInfo
functiondropBLOBColumns(  $serializedDataInfo ) : void

Parameters
Name Type Description
$serializedDataInfo
functiondropContentClassAttributeTempTable( ) : void

functioneZExecuteShellCommand(  $command,  $errMessage = '',  $retry = true,  $ignore = false ) : void

Parameters
Name Type Description
$command
$errMessage
$retry
$ignore
functioneZGetUserInput(  $prompt ) : void

Parameters
Name Type Description
$prompt
functionparseCustomSerializedDataOption(  $serializedCustomDataOption ) : void

Parameters
Name Type Description
$serializedCustomDataOption
functionparseCustomXMLDataOption(  $xmlCustomDataOption ) : void

Parameters
Name Type Description
$xmlCustomDataOption
functionparseXMLAttributesOption(  $xmlAttributesOption ) : void

Parameters
Name Type Description
$xmlAttributesOption
functionremoveIllegalUTF8Characters(  $text ) : void

For some reason, some utf8 encoded text stored in the db might contain illegal utf8 characters.

This function will strip/replace such known characters

Parameters
Name Type Description
$text
functionrestoreSerializedData(  $serializedDataInfo ) : void

Parameters
Name Type Description
$serializedDataInfo
functionserializeContentClassAttributeNames( ) : void

functionserializeContentClassNames( ) : void

functionserializeNames(  $selectSQL,  $storeToTable ) : void

Parameters
Name Type Description
$selectSQL
$storeToTable
functionshowError(  $message,  $addEOL = true,  $bailOut = true ) : void

Parameters
Name Type Description
$message
$addEOL
$bailOut
functionshowMessage(  $message,  $addEOL = true ) : void

Parameters
Name Type Description
$message
$addEOL
functionshowMessage2(  $message,  $addEOL = true ) : void

Parameters
Name Type Description
$message
$addEOL
functionshowMessage3(  $message,  $addEOL = true ) : void

Parameters
Name Type Description
$message
$addEOL
functionshowNotice(  $message,  $addEOL = true ) : void

Parameters
Name Type Description
$message
$addEOL
functionshowWarning(  $message,  $addEOL = true ) : void

Parameters
Name Type Description
$message
$addEOL
functionstoreSerializedName(  $serializedName,  $id,  $version,  $table ) : void

Parameters
Name Type Description
$serializedName
$id
$version
$table
functionunserializeContentClassAttributeNames( ) : void

functionxmlCustomDataSelectSQL(  $dataTableInfo ) : void

Parameters
Name Type Description
$dataTableInfo
functionxmlCustomDataUpdateSQL(  $dataTableInfo,  $row ) : void

Parameters
Name Type Description
$dataTableInfo
$row
functionxmlDatatypeSelectSQL(  $dataTableInfo ) : void

Parameters
Name Type Description
$dataTableInfo
functionxmlDatatypeUpdateSQL(  $dataTableInfo,  $row ) : void

Parameters
Name Type Description
$dataTableInfo
$row

\CommandLineArguments

Package: Default

Class used to store some of the command line arguments

Properties

Propertyprotected  $iconvCharacterSet= 'false'
static
Default valuefalseDetails
Type
n/a
Propertyprotected  $logFilename= 'false'
static
Default valuefalseDetails
Type
n/a

Methods

methodpubliciconvCharacterSet( ) : void

methodpubliclogFilename( ) : void

methodpublicsetIconvCharacterSet(  $iconvCharacterSet ) : void

Parameters
Name Type Description
$iconvCharacterSet
methodpublicsetLogFilename(  $logFilename ) : void

Parameters
Name Type Description
$logFilename
Documentation was generated by DocBlox 0.18.1.