]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-17020 dml: native pgsql driver - fixed wrong handling of binary fields in get_col...
authorskodak <skodak>
Mon, 27 Oct 2008 21:57:45 +0000 (21:57 +0000)
committerskodak <skodak>
Mon, 27 Oct 2008 21:57:45 +0000 (21:57 +0000)
lib/dml/pgsql_native_moodle_database.php

index 34d483392f43373abffbd024eb9eddf398ffeca8..94b3d07ec3f207d404a7974eacd4e0652061bb5c 100644 (file)
@@ -247,8 +247,8 @@ class pgsql_native_moodle_database extends moodle_database {
                 $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) {
@@ -279,11 +279,11 @@ class pgsql_native_moodle_database extends moodle_database {
                     $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 {
@@ -300,8 +300,8 @@ class pgsql_native_moodle_database extends moodle_database {
                 $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 {
@@ -318,8 +318,8 @@ class pgsql_native_moodle_database extends moodle_database {
                 $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 {
@@ -341,8 +341,8 @@ class pgsql_native_moodle_database extends moodle_database {
                 $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) {
@@ -365,7 +365,7 @@ class pgsql_native_moodle_database extends moodle_database {
                 $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;