This class provides methods for building a DB generation script, getting a full overview on abstract table definitions and more...
More...
|
| __construct () |
| Constructor. More...
|
|
| setTargetEncoding ($a_encoding) |
| Set the desired target encoding If the target encoding os different from UTF-8 all text values will be shortened to length of of the current text field. More...
|
|
| getTargetEncoding () |
| Returns the target encoding. More...
|
|
| setBlackList ($a_blacklist) |
| Set Table Black List. More...
|
|
| getBlackList () |
| Get Table Black List. More...
|
|
| setWhiteList ($a_whitelist) |
| Set Table White List. More...
|
|
| getWhiteList () |
| Get Table White List. More...
|
|
| setFilter ($a_filter, $a_value) |
|
| getTables () |
|
| checkProcessing ($a_table) |
| Check whether a table should be processed or not. More...
|
|
| buildDBGenerationScript ($a_filename="") |
| Build DB generation script. More...
|
|
| buildCreateTableStatement ($a_table, $a_file="") |
| Build CreateTable statement. More...
|
|
| buildAddPrimaryKeyStatement ($a_table, $a_file="") |
| Build AddPrimaryKey statement. More...
|
|
| buildAddIndexStatements ($a_table, $a_file="") |
| Build AddIndex statements. More...
|
|
| buildAddUniqueConstraintStatements ($a_table, $a_file="") |
| Build AddUniqueConstraint statements. More...
|
|
| buildCreateSequenceStatement ($a_table, $a_file="") |
| Build CreateSequence statement. More...
|
|
| buildSingularSequenceStatement ($a_file="") |
| Build CreateSequence statement (if not belonging to table) More...
|
|
| buildInsertStatement ($a_table, $a_basedir) |
| Write seerialized insert data to array. More...
|
|
| buildInsertStatementsXML ($a_table, $a_basedir) |
|
| buildInsertStatements ($a_table, $a_file="") |
| Build Insert statements. More...
|
|
| getHTMLOverview ($a_filename="") |
| Get table definition overview in HTML. More...
|
|
| addTableToOverview ($a_table, $a_tpl, $a_cnt) |
| Add table to overview template. More...
|
|
This class provides methods for building a DB generation script, getting a full overview on abstract table definitions and more...
- Author
- Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
- Version
- Id
- class.ilDBUpdate.php 18649 2009-01-21 09:59:23Z akill
Definition at line 13 of file class.ilDBGenerator.php.
◆ __construct()
ilDBGenerator::__construct |
( |
| ) |
|
◆ addTableToOverview()
ilDBGenerator::addTableToOverview |
( |
|
$a_table, |
|
|
|
$a_tpl, |
|
|
|
$a_cnt |
|
) |
| |
Add table to overview template.
Definition at line 751 of file class.ilDBGenerator.php.
References Vendor\Package\$f, $index, and filter().
Referenced by getHTMLOverview().
753 $fields = $this->analyzer->getFieldInformation($a_table);
754 $indices = $this->analyzer->getIndicesInformation($a_table);
755 $constraints = $this->analyzer->getConstraintsInformation($a_table);
756 $pk = $this->analyzer->getPrimaryKeyInformation($a_table);
757 $auto = $this->analyzer->getAutoIncrementField($a_table);
758 $has_sequence = $this->analyzer->hasSequence($a_table);
761 if (isset($this->
filter[
"has_sequence"])) {
762 if ((!$has_sequence && $auto ==
"" && $this->
filter[
"has_sequence"])
763 || (($has_sequence || $auto !=
"") && !$this->
filter[
"has_sequence"])
770 $indices_output =
false;
771 if (is_array($indices) && count($indices) > 0 && !$this->
filter[
"skip_indices"]) {
772 foreach ($indices as
$index => $def) {
774 foreach ($def[
"fields"] as
$f => $pos) {
777 $a_tpl->setCurrentBlock(
"index");
778 $a_tpl->setVariable(
"VAL_INDEX", $def[
"name"]);
779 $a_tpl->setVariable(
"VAL_FIELDS", implode(
", ", $f2));
780 $a_tpl->parseCurrentBlock();
781 $indices_output =
true;
783 $a_tpl->setCurrentBlock(
"index_table");
784 $a_tpl->parseCurrentBlock();
788 $constraints_output =
false;
789 if (is_array($constraints) && count($constraints) > 0 && !$this->
filter[
"skip_constraints"]) {
790 foreach ($constraints as
$index => $def) {
792 foreach ($def[
"fields"] as
$f => $pos) {
795 $a_tpl->setCurrentBlock(
"constraint");
796 $a_tpl->setVariable(
"VAL_CONSTRAINT", $def[
"name"]);
797 $a_tpl->setVariable(
"VAL_CTYPE", $def[
"type"]);
798 $a_tpl->setVariable(
"VAL_CFIELDS", implode(
", ", $f2));
799 $a_tpl->parseCurrentBlock();
800 $constraints_output =
true;
802 $a_tpl->setCurrentBlock(
"constraint_table");
803 $a_tpl->parseCurrentBlock();
807 $fields_output =
false;
808 foreach ($fields as $field => $def) {
810 if (isset($this->
filter[
"alt_types"])) {
811 if (($def[
"alt_types"] ==
"" && $this->
filter[
"alt_types"])
812 || ($def[
"alt_types"] !=
"" && !$this->
filter[
"alt_types"])
817 if (isset($this->
filter[
"type"])) {
818 if ($def[
"type"] != $this->
filter[
"type"]) {
822 if (isset($this->
filter[
"nativetype"])) {
823 if ($def[
"nativetype"] != $this->
filter[
"nativetype"]) {
827 if (isset($this->
filter[
"unsigned"])) {
828 if ($def[
"unsigned"] != $this->
filter[
"unsigned"]) {
833 $a_tpl->setCurrentBlock(
"field");
834 if (empty($pk[
"fields"][$field])) {
835 $a_tpl->setVariable(
"VAL_FIELD", strtolower($field));
837 $a_tpl->setVariable(
"VAL_FIELD",
"<u>" . strtolower($field) .
"</u>");
839 $a_tpl->setVariable(
"VAL_TYPE", $def[
"type"]);
840 $a_tpl->setVariable(
"VAL_LENGTH", (!is_null($def[
"length"])) ? $def[
"length"] :
" ");
842 if (strtolower($def[
"default"]) ==
"current_timestamp") {
844 unset($def[
"default"]);
847 $a_tpl->setVariable(
"VAL_DEFAULT", (!is_null($def[
"default"])) ? $def[
"default"] :
" ");
848 $a_tpl->setVariable(
"VAL_NOT_NULL", (!is_null($def[
"notnull"])) ? (($def[
"notnull"]) ?
"true" :
"false") :
" ");
849 $a_tpl->setVariable(
"VAL_FIXED", (!is_null($def[
"fixed"])) ? (($def[
"fixed"]) ?
"true" :
"false") :
" ");
850 $a_tpl->setVariable(
"VAL_UNSIGNED", (!is_null($def[
"unsigned"])) ? (($def[
"unsigned"]) ?
"true" :
"false") :
" ");
851 $a_tpl->setVariable(
"VAL_ALTERNATIVE_TYPES", ($def[
"alt_types"] !=
"") ? $def[
"alt_types"] :
" ");
852 $a_tpl->setVariable(
"VAL_NATIVETYPE", ($def[
"nativetype"] !=
"") ? $def[
"nativetype"] :
" ");
853 $a_tpl->parseCurrentBlock();
854 $fields_output =
true;
857 if ($fields_output) {
858 $a_tpl->setCurrentBlock(
"field_table");
859 $a_tpl->parseCurrentBlock();
863 if ($indices_output || $fields_output || $constraints_output) {
864 $a_tpl->setCurrentBlock(
"table");
865 $a_tpl->setVariable(
"TXT_TABLE_NAME", strtolower($a_table));
866 if ($has_sequence || $auto !=
"") {
867 $a_tpl->setVariable(
"TXT_SEQUENCE",
"Has Sequence");
869 $a_tpl->setVariable(
"TXT_SEQUENCE",
"No Sequence");
871 $a_tpl->setVariable(
"VAL_CNT", (
int) $a_cnt);
872 $a_tpl->parseCurrentBlock();
◆ buildAddIndexStatements()
ilDBGenerator::buildAddIndexStatements |
( |
|
$a_table, |
|
|
|
$a_file = "" |
|
) |
| |
Build AddIndex statements.
- Parameters
-
string | table name |
file | file resource or empty string |
Definition at line 463 of file class.ilDBGenerator.php.
References Vendor\Package\$f, and $i.
Referenced by buildDBGenerationScript().
465 $ind = $this->analyzer->getIndicesInformation($a_table,
true);
467 if (is_array($ind)) {
468 foreach ($ind as
$i) {
469 if ($i[
"fulltext"]) {
474 $in_st =
"\n" .
'$in_fields = array(';
476 foreach ($i[
"fields"] as
$f => $pos) {
477 $in_st .= $sep .
'"' .
$f .
'"';
481 $in_st .=
'$ilDB->addIndex("' . $a_table .
'", $in_fields, "' . $i[
"name"] .
'"' . $ft .
');' .
"\n";
486 fwrite($a_file, $in_st);
◆ buildAddPrimaryKeyStatement()
ilDBGenerator::buildAddPrimaryKeyStatement |
( |
|
$a_table, |
|
|
|
$a_file = "" |
|
) |
| |
Build AddPrimaryKey statement.
- Parameters
-
string | table name |
file | file resource or empty string |
Definition at line 434 of file class.ilDBGenerator.php.
References Vendor\Package\$f.
Referenced by buildDBGenerationScript().
436 $pk = $this->analyzer->getPrimaryKeyInformation($a_table);
438 if (is_array($pk[
"fields"]) && count($pk[
"fields"]) > 0) {
439 $pk_st =
"\n" .
'$pk_fields = array(';
441 foreach ($pk[
"fields"] as
$f => $pos) {
442 $pk_st .= $sep .
'"' .
$f .
'"';
446 $pk_st .=
'$ilDB->addPrimaryKey("' . $a_table .
'", $pk_fields);' .
"\n";
451 fwrite($a_file, $pk_st);
◆ buildAddUniqueConstraintStatements()
ilDBGenerator::buildAddUniqueConstraintStatements |
( |
|
$a_table, |
|
|
|
$a_file = "" |
|
) |
| |
Build AddUniqueConstraint statements.
- Parameters
-
string | table name |
file | file resource or empty string |
Definition at line 499 of file class.ilDBGenerator.php.
References Vendor\Package\$f, and $i.
Referenced by buildDBGenerationScript().
501 $con = $this->analyzer->getConstraintsInformation($a_table,
true);
503 if (is_array($con)) {
504 foreach ($con as
$i) {
505 $in_st =
"\n" .
'$in_fields = array(';
507 foreach ($i[
"fields"] as
$f => $pos) {
508 $in_st .= $sep .
'"' .
$f .
'"';
512 $in_st .=
'$ilDB->addUniqueConstraint("' . $a_table .
'", $in_fields, "' . $i[
"name"] .
'");' .
"\n";
517 fwrite($a_file, $in_st);
◆ buildCreateSequenceStatement()
ilDBGenerator::buildCreateSequenceStatement |
( |
|
$a_table, |
|
|
|
$a_file = "" |
|
) |
| |
Build CreateSequence statement.
- Parameters
-
string | table name |
file | file resource or empty string |
Definition at line 530 of file class.ilDBGenerator.php.
Referenced by buildDBGenerationScript().
532 $seq = $this->analyzer->hasSequence($a_table);
533 if ($seq !==
false) {
534 $seq_st =
"\n" .
'$ilDB->createSequence("' . $a_table .
'", ' . (int) $seq .
');' .
"\n";
539 fwrite($a_file, $seq_st);
◆ buildCreateTableStatement()
ilDBGenerator::buildCreateTableStatement |
( |
|
$a_table, |
|
|
|
$a_file = "" |
|
) |
| |
Build CreateTable statement.
- Parameters
-
string | table name |
file | file resource or empty string |
Definition at line 383 of file class.ilDBGenerator.php.
References Vendor\Package\$f, and fields.
Referenced by buildDBGenerationScript().
385 $fields = $this->analyzer->getFieldInformation($a_table,
true);
387 $create_st =
"\n\n//\n// " . $a_table .
"\n//\n";
388 $create_st .=
'$fields = array (' .
"\n";
390 foreach ($fields as
$f => $def) {
391 $create_st .=
"\t" . $f_sep .
'"' .
$f .
'" => array (' .
"\n";
394 foreach ($def as $k => $v) {
395 if ($k !=
"nativetype" && $k !=
"alt_types" && $k !=
"autoincrement" && !is_null($v)) {
400 $v = $v ?
"true" :
"false";
411 $create_st .=
"\t\t" . $a_sep .
'"' . $k .
'" => ' . $v .
"\n";
415 $create_st .=
"\t" .
')' .
"\n";
417 $create_st .=
');' .
"\n";
418 $create_st .=
'$ilDB->createTable("' . $a_table .
'", $fields);' .
"\n";
423 fwrite($a_file, $create_st);
◆ buildDBGenerationScript()
ilDBGenerator::buildDBGenerationScript |
( |
|
$a_filename = "" | ) |
|
Build DB generation script.
- Parameters
-
string | output filename, if no filename is given, script is echoed |
Definition at line 290 of file class.ilDBGenerator.php.
References $ok, buildAddIndexStatements(), buildAddPrimaryKeyStatement(), buildAddUniqueConstraintStatements(), buildCreateSequenceStatement(), buildCreateTableStatement(), buildInsertStatement(), buildInsertStatements(), buildSingularSequenceStatement(), checkProcessing(), closeFile(), getTables(), and openFile().
292 if (@is_dir($a_filename)) {
296 $isDirectory =
false;
301 if ($a_filename !=
"" and !$isDirectory) {
302 $file = fopen($a_filename,
"w");
304 $start =
'<?php' .
"\n" .
'function setupILIASDatabase()' .
"\n{\n";
305 $start .=
"\t" .
'global $ilDB;' .
"\n\n";
306 fwrite($file, $start);
307 } elseif ($isDirectory) {
315 foreach ($this->tables as $table) {
317 if ($a_filename !=
"") {
322 $file = $this->
openFile($path .
'/' . $table);
340 if (in_array($table, array(
'usr_session_stats',
'usr_session_raw'))) {
347 #$this->buildInsertStatementsXML($table,$path); 356 if ($a_filename !=
"") {
357 echo
"<br><b>missing: " . $table .
"</b>";
366 if ($a_filename ==
"") {
368 } elseif (!$isDirectory) {
370 $ok = fwrite($file, $end);
buildAddIndexStatements($a_table, $a_file="")
Build AddIndex statements.
buildInsertStatement($a_table, $a_basedir)
Write seerialized insert data to array.
buildAddPrimaryKeyStatement($a_table, $a_file="")
Build AddPrimaryKey statement.
buildCreateTableStatement($a_table, $a_file="")
Build CreateTable statement.
buildInsertStatements($a_table, $a_file="")
Build Insert statements.
buildSingularSequenceStatement($a_file="")
Build CreateSequence statement (if not belonging to table)
checkProcessing($a_table)
Check whether a table should be processed or not.
buildAddUniqueConstraintStatements($a_table, $a_file="")
Build AddUniqueConstraint statements.
buildCreateSequenceStatement($a_table, $a_file="")
Build CreateSequence statement.
◆ buildInsertStatement()
ilDBGenerator::buildInsertStatement |
( |
|
$a_table, |
|
|
|
$a_basedir |
|
) |
| |
Write seerialized insert data to array.
- Parameters
-
object | $a_table | |
object | $a_basedir | |
- Returns
Definition at line 580 of file class.ilDBGenerator.php.
References $DIC, Vendor\Package\$f, $rows, fields, and shortenText().
Referenced by buildDBGenerationScript().
583 $ilLogger = $DIC->logger()->root();
585 $ilLogger->log(
'Starting export of:' . $a_table);
587 $set = $this->il_db->query(
"SELECT * FROM " . $this->il_db->quoteIdentifier($a_table));
591 mkdir($a_basedir .
'/' . $a_table .
'_inserts', fileperms($a_basedir));
594 while ($rec = $this->il_db->fetchAssoc($set)) {
596 foreach ($rec as
$f => $v) {
597 if ($this->
fields[
$f][
'type'] ==
'text' and $this->
fields[
$f][
'length'] >= 1000) {
607 $rows[$a_table][$row++] = $values;
610 $ilLogger->log(
'Writing insert statements after 1000 lines...');
611 $fp = fopen($a_basedir .
'/' . $a_table .
'_inserts/' . $filenum++ .
'.data',
'w');
612 fwrite($fp, serialize((array)
$rows));
620 $fp = fopen($a_basedir .
'/' . $a_table .
'_inserts/' . $filenum++ .
'.data',
'w');
621 fwrite($fp, serialize((array)
$rows) .
"\n");
625 $ilLogger->log(
'Finished export of: ' . $a_table);
626 if (function_exists(
'memory_get_usage')) {
627 $ilLogger->log(
'Memory usage: ' . memory_get_usage(
true));
shortenText($table, $field, $a_value, $a_size)
Shorten text depending on target encoding.
◆ buildInsertStatements()
ilDBGenerator::buildInsertStatements |
( |
|
$a_table, |
|
|
|
$a_file = "" |
|
) |
| |
Build Insert statements.
- Parameters
-
string | table name |
file | file resource or empty string |
Definition at line 680 of file class.ilDBGenerator.php.
References Vendor\Package\$f, and fields.
Referenced by buildDBGenerationScript().
682 if ($a_table ==
"lng_data") {
686 $set = $this->il_db->query(
"SELECT * FROM " . $this->il_db->quoteIdentifier($a_table));
689 while ($rec = $this->il_db->fetchAssoc($set)) {
694 foreach ($rec as
$f => $v) {
696 $types[] =
'"' . $this->
fields[
$f][
"type"] .
'"';
697 $v = str_replace(
'\\',
'\\\\', $v);
698 $values[] =
"'" . str_replace(
"'",
"\'", $v) .
"'";
699 $i_str[] =
"'" .
$f .
"' => array('" . $this->
fields[
$f][
"type"] .
"', '" . str_replace(
"'",
"\'", $v) .
"')";
701 $fields_str =
"(" . implode(
",", $fields) .
")";
702 $types_str =
"array(" . implode(
",", $types) .
")";
703 $values_str =
"array(" . implode(
",", $values) .
")";
704 $ins_st =
"\n" .
'$ilDB->insert("' . $a_table .
'", array(' .
"\n";
705 $ins_st .= implode(
", ", $i_str) .
"));\n";
713 fwrite($a_file, $ins_st);
◆ buildInsertStatementsXML()
ilDBGenerator::buildInsertStatementsXML |
( |
|
$a_table, |
|
|
|
$a_basedir |
|
) |
| |
- Parameters
-
object | $a_table | |
object | $a_file | [optional] |
- Returns
Definition at line 640 of file class.ilDBGenerator.php.
References Vendor\Package\$f, fields, and shortenText().
643 $w->xmlStartTag(
'Table', array(
'name' => $a_table ));
645 $set = $this->il_db->query(
"SELECT * FROM " . $this->il_db->quoteIdentifier($a_table));
648 while ($rec = $this->il_db->fetchAssoc($set)) {
649 #$ilLog->write('Num: '.$num++); 650 $w->xmlStartTag(
'Row');
655 foreach ($rec as
$f => $v) {
656 if ($this->
fields[
$f][
'type'] ==
'text' and $this->
fields[
$f][
'length'] >= 1000) {
660 $w->xmlElement(
'Value', array(
662 'type' => $this->
fields[
$f][
'type'],
666 $w->xmlEndTag(
'Row');
668 $w->xmlEndTag(
'Table');
670 $w->xmlDumpFile($a_basedir .
'/' . $a_table .
'.xml',
false);
shortenText($table, $field, $a_value, $a_size)
Shorten text depending on target encoding.
◆ buildSingularSequenceStatement()
ilDBGenerator::buildSingularSequenceStatement |
( |
|
$a_file = "" | ) |
|
Build CreateSequence statement (if not belonging to table)
- Parameters
-
file | file resource or empty string |
Definition at line 550 of file class.ilDBGenerator.php.
Referenced by buildDBGenerationScript().
552 $r = $this->manager->listSequences();
554 foreach ($r as $seq) {
555 if (!in_array($seq, $this->tables)) {
557 if ($seq ==
"sahs_sc13_seq") {
561 $create_st =
"\n" .
'$ilDB->createSequence("' . $seq .
'");' .
"\n";
566 fwrite($a_file, $create_st);
◆ checkProcessing()
ilDBGenerator::checkProcessing |
( |
|
$a_table | ) |
|
◆ closeFile()
ilDBGenerator::closeFile |
( |
|
$fp | ) |
|
|
protected |
◆ getBlackList()
ilDBGenerator::getBlackList |
( |
| ) |
|
◆ getHTMLOverview()
ilDBGenerator::getHTMLOverview |
( |
|
$a_filename = "" | ) |
|
Get table definition overview in HTML.
- Parameters
-
string | output filename, if no filename is given, script is echoed |
Definition at line 725 of file class.ilDBGenerator.php.
References $tpl, addTableToOverview(), checkProcessing(), getTables(), and ILIAS_VERSION.
731 foreach ($this->tables as $table) {
740 $tpl->setVariable(
"TXT_TITLE",
"ILIAS Abstract DB Tables (" .
ILIAS_VERSION .
")");
742 if ($a_filename ==
"") {
special template class to simplify handling of ITX/PEAR
addTableToOverview($a_table, $a_tpl, $a_cnt)
Add table to overview template.
checkProcessing($a_table)
Check whether a table should be processed or not.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
◆ getTables()
ilDBGenerator::getTables |
( |
| ) |
|
◆ getTargetEncoding()
ilDBGenerator::getTargetEncoding |
( |
| ) |
|
◆ getWhiteList()
ilDBGenerator::getWhiteList |
( |
| ) |
|
◆ lookupAbstractedTables()
static ilDBGenerator::lookupAbstractedTables |
( |
| ) |
|
|
static |
- Returns
- array
- Deprecated:
- abstraction_progress is no longer used in ILIAS
Definition at line 58 of file class.ilDBGenerator.php.
References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.
61 $ilDB = $DIC->database();
63 $query =
"SELECT DISTINCT(table_name) FROM abstraction_progress ";
67 $names[] = $row->table_name;
73 $abs_tables = array_merge($names, array(
75 'acc_user_access_key',
78 'qpl_question_orderinghorizontal',
79 'qpl_question_fileupload',
82 'style_template_class',
86 'page_editor_settings',
101 'qpl_qst_javaapplet',
107 'qpl_qst_textsubset',
foreach($_POST as $key=> $value) $res
◆ openFile()
ilDBGenerator::openFile |
( |
|
$a_path | ) |
|
|
protected |
Definition at line 251 of file class.ilDBGenerator.php.
Referenced by buildDBGenerationScript().
254 $file = fopen($a_path,
"w");
255 $start .=
"\t" .
'global $ilDB;' .
"\n\n";
256 fwrite($file, $start);
261 $file = fopen($a_path,
"w");
262 $start =
'<?php' .
"\n" .
'function setupILIASDatabase()' .
"\n{\n";
263 $start .=
"\t" .
'global $ilDB;' .
"\n\n";
264 fwrite($file, $start);
◆ setBlackList()
ilDBGenerator::setBlackList |
( |
|
$a_blacklist | ) |
|
Set Table Black List.
(Tables that should not be included in the processing)
- Parameters
-
array | $a_blacklist | Table Black List |
Definition at line 169 of file class.ilDBGenerator.php.
171 $this->blacklist = $a_blacklist;
◆ setFilter()
ilDBGenerator::setFilter |
( |
|
$a_filter, |
|
|
|
$a_value |
|
) |
| |
◆ setTargetEncoding()
ilDBGenerator::setTargetEncoding |
( |
|
$a_encoding | ) |
|
Set the desired target encoding If the target encoding os different from UTF-8 all text values will be shortened to length of of the current text field.
E.g: il_meta_keyword keyword(4000) target encoding: UTF16
=> $value = mb_convert_encoding($value,'UTF-8','UTF-16'); $value = mb_strcut($value,0,4000,'UTF16'); $value = mb_convert_encoding($value,'UTF-16','UTF-8');
- Parameters
-
- Returns
Definition at line 146 of file class.ilDBGenerator.php.
148 $this->target_encoding = $a_encoding;
◆ setWhiteList()
ilDBGenerator::setWhiteList |
( |
|
$a_whitelist | ) |
|
Set Table White List.
Per default all tables are included in the processing. If a white list ist provided, only them will be used.
- Parameters
-
array | $a_whitelist | Table White List |
Definition at line 193 of file class.ilDBGenerator.php.
195 $this->whitelist = $a_whitelist;
◆ shortenText()
ilDBGenerator::shortenText |
( |
|
$table, |
|
|
|
$field, |
|
|
|
$a_value, |
|
|
|
$a_size |
|
) |
| |
|
protected |
Shorten text depending on target encoding.
- Parameters
-
string | $table | |
string | $field | |
string | $a_value | |
int | $a_size | |
- Returns
- string
Definition at line 890 of file class.ilDBGenerator.php.
References $DIC, fields, getTargetEncoding(), and ilStr\shortenText().
Referenced by buildInsertStatement(), and buildInsertStatementsXML().
893 $ilLogger = $DIC->logger()->root();
903 $shortened = mb_convert_encoding($shortened,
'UTF-8', $this->
getTargetEncoding());
905 if (strlen($a_value) != strlen($shortened)) {
906 $ilLogger->log(
'Table : ' . $table);
907 $ilLogger->log(
'Field : ' . $field);
908 $ilLogger->log(
'Type : ' . $this->
fields[$field][
'type']);
909 $ilLogger->log(
'Length : ' . $this->
fields[$field][
'length']);
910 $ilLogger->log(
'Before : ' . $a_value);
911 $ilLogger->log(
'Shortened : ' . $shortened);
912 $ilLogger->log(
'Strlen Before: ' . strlen($a_value));
913 $ilLogger->log(
'Strlen After : ' . strlen($shortened));
static shortenText($a_string, $a_start_pos, $a_num_bytes, $a_encoding='UTF-8')
Shorten text to the given number of bytes.
getTargetEncoding()
Returns the target encoding.
◆ $blacklist
ilDBGenerator::$blacklist = array() |
|
protected |
◆ $filter
ilDBGenerator::$filter = array() |
|
protected |
◆ $tables
ilDBGenerator::$tables = array() |
|
protected |
◆ $target_encoding
ilDBGenerator::$target_encoding = 'UTF-8' |
|
protected |
◆ $whitelist
ilDBGenerator::$whitelist = array() |
|
protected |
The documentation for this class was generated from the following file: