phpLens
 home  products examples manual  faq support forum  contact news  login store

Forums: phplens   adodb
Forums:   ADOdb Help & Dev:   Replies 
Search
Topic: PostgreSQL can't AlterColumnSQL from bool to int
author: dregad   created: 20-06-2012 10:40:14 AM
Basically reporting a new issue for case 1 in http ://phplens.com/lens/lensforum/msgs.php?id=17397 with updated patch against 5.17


diff --git a/library/adodb/datadict/datadict-postgres.inc.php b/library/adodb/datadict/datadict-postgres.inc.php
index 10789bc..5c0f6ff 100644
--- a/library/adodb/datadict/datadict-postgres.inc.php
+++ b/library/adodb/datadict/datadict-postgres.inc.php
@@ -136,7 +136,7 @@ class ADODB2_postgres extends ADODB_DataDict {
if (($not_null = preg_match('/NOT NULL/i',$v))) {
$v = preg_replace('/NOT NULL/i','',$v);
}
- if (preg_match('/^([^ ]+) .*DEFAULT ([^ ]+)/',$v,$matches)) {
+ if (preg_match('/^([^ ]+) .*DEFAULT (\'[^\']+\'|\"[^\"]+\"|[^ ]+)/',$v,$matches)) {
list(,$colname,$default) = $matches;
$sql[] = $alter . str_replace('DEFAULT '.$default,'',$v);
$sql[] = 'UPDATE '.$tabname.' SET '.$colname.'='.$default;
@@ -201,7 +201,7 @@ class ADODB2_postgres extends ADODB_DataDict {
$v = preg_replace('/\sNULL/i','',$v);
}

- if (preg_match('/^([^ ]+) .*DEFAULT ([^ ]+)/',$v,$matches)) {
+ if (preg_match('/^([^ ]+) .*DEFAULT (\'[^\']+\'|\"[^\"]+\"|[^ ]+)/',$v,$matches)) {
$existing = $this->MetaColumns($tabname);
list(,$colname,$default) = $matches;
$v = preg_replace('/^' . preg_quote($colname) . '\s/', '', $v);


Note: this should be applied after patch reported in http ://phplens.com/lens/lensforum/msgs.php?id=19204
Topic: Re:PostgreSQL can't AlterColumnSQL from bool to int
author: dregad   created: 20-06-2012 10:43:51 AM
Please disregard this thread - refer to correct posting in http ://phplens.com/lens/lensforum/msgs.php?id=19213

Sorry for the mess.
Page 1
Search

View Source

email: contact#phplens.com (change # to @)     telephone (malaysia): 60-3-7947 2888     fax (malaysia): 60-3-7947 2800