Skip to content

Commit

Permalink
MDL-17020 dml: native pgsql driver - fixed wrong handling of binary f…
Browse files Browse the repository at this point in the history
…ields in get_column()
  • Loading branch information
skodak committed Oct 27, 2008
1 parent 2958a49 commit 298d925
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/dml/pgsql_native_moodle_database.php
Expand Up @@ -247,8 +247,8 @@ public function get_columns($table, $usecache=true) {
$info->meta_type = 'C';
$info->max_length = $rawcolumn->atttypmod - 4;
$info->scale = null;
$info->not_null = (bool)$rawcolumn->attnotnull;
$info->has_default = (bool)$rawcolumn->atthasdef;
$info->not_null = ($rawcolumn->attnotnull === 't');
$info->has_default = ($rawcolumn->atthasdef === 't');
if ($info->has_default) {
$parts = explode('::', $rawcolumn->adsrc);
if (count($parts) > 1) {
Expand Down Expand Up @@ -279,11 +279,11 @@ public function get_columns($table, $usecache=true) {
$info->meta_type = 'I';
$info->unique = null;
$info->auto_increment= false;
$info->has_default = (bool)$rawcolumn->atthasdef;
$info->has_default = ($rawcolumn->atthasdef === 't');
}
$info->max_length = $matches[1];
$info->scale = null;
$info->not_null = (bool)$rawcolumn->attnotnull;
$info->not_null = ($rawcolumn->attnotnull === 't');
if ($info->has_default) {
$info->default_value = $rawcolumn->adsrc;
} else {
Expand All @@ -300,8 +300,8 @@ public function get_columns($table, $usecache=true) {
$info->unsigned = null;
$info->auto_increment= false;
$info->unique = null;
$info->not_null = (bool)$rawcolumn->attnotnull;
$info->has_default = (bool)$rawcolumn->atthasdef;
$info->not_null = ($rawcolumn->attnotnull === 't');
$info->has_default = ($rawcolumn->atthasdef === 't');
if ($info->has_default) {
$info->default_value = $rawcolumn->adsrc;
} else {
Expand All @@ -318,8 +318,8 @@ public function get_columns($table, $usecache=true) {
$info->unsigned = null;
$info->auto_increment= false;
$info->unique = null;
$info->not_null = (bool)$rawcolumn->attnotnull;
$info->has_default = (bool)$rawcolumn->atthasdef;
$info->not_null = ($rawcolumn->attnotnull === 't');
$info->has_default = ($rawcolumn->atthasdef === 't');
if ($info->has_default) {
$info->default_value = $rawcolumn->adsrc;
} else {
Expand All @@ -341,8 +341,8 @@ public function get_columns($table, $usecache=true) {
$info->meta_type = 'X';
$info->max_length = -1;
$info->scale = null;
$info->not_null = (bool)$rawcolumn->attnotnull;
$info->has_default = (bool)$rawcolumn->atthasdef;
$info->not_null = ($rawcolumn->attnotnull === 't');
$info->has_default = ($rawcolumn->atthasdef === 't');
if ($info->has_default) {
$parts = explode('::', $rawcolumn->adsrc);
if (count($parts) > 1) {
Expand All @@ -365,7 +365,7 @@ public function get_columns($table, $usecache=true) {
$info->meta_type = 'B';
$info->max_length = -1;
$info->scale = null;
$info->not_null = (bool)$rawcolumn->attnotnull;
$info->not_null = ($rawcolumn->attnotnull === 't');
$info->has_default = false;
$info->default_value = null;
$info->primary_key = false;
Expand Down

0 comments on commit 298d925

Please sign in to comment.