Changeset 640
- Timestamp:
- 11/13/07 14:49:43 (1 year ago)
- Files:
-
- trunk/build/manifests/testapp.mn (modified) (2 diffs)
- trunk/build/manifests/testapp.mn (modified) (2 diffs)
- trunk/lib/jelix-scripts/commands/createdao.cmd.php (modified) (1 diff)
- trunk/lib/jelix-scripts/commands/createdao.cmd.php (modified) (1 diff)
- trunk/lib/jelix/dao/jDaoGenerator.class.php (modified) (1 diff)
- trunk/lib/jelix/dao/jDaoGenerator.class.php (modified) (1 diff)
- trunk/lib/jelix/dao/jDaoParser.class.php (modified) (4 diffs)
- trunk/lib/jelix/dao/jDaoParser.class.php (modified) (4 diffs)
- trunk/lib/jelix/plugins/db/mysql/mysql.dbtools.php (modified) (2 diffs)
- trunk/lib/jelix/plugins/db/mysql/mysql.dbtools.php (modified) (2 diffs)
- trunk/lib/jelix/plugins/db/pgsql/pgsql.dbconnection.php (modified) (1 diff)
- trunk/lib/jelix/plugins/db/pgsql/pgsql.dbconnection.php (modified) (1 diff)
- trunk/lib/jelix/plugins/db/pgsql/pgsql.dbtools.php (modified) (3 diffs)
- trunk/lib/jelix/plugins/db/pgsql/pgsql.dbtools.php (modified) (3 diffs)
- trunk/lib/jelix/plugins/db/sqlite/sqlite.dbconnection.php (modified) (1 diff)
- trunk/lib/jelix/plugins/db/sqlite/sqlite.dbconnection.php (modified) (1 diff)
- trunk/lib/jelix/plugins/db/sqlite/sqlite.dbtools.php (modified) (4 diffs)
- trunk/lib/jelix/plugins/db/sqlite/sqlite.dbtools.php (modified) (4 diffs)
- trunk/testapp/modules/jelix_tests/daos/products.dao.xml (modified) (1 diff)
- trunk/testapp/modules/jelix_tests/daos/products.dao.xml (modified) (1 diff)
- trunk/testapp/modules/jelix_tests/tests/jdao.parser.html.php (modified) (1 diff)
- trunk/testapp/modules/jelix_tests/tests/jdao.parser.html.php (modified) (1 diff)
- trunk/testapp/modules/jelix_tests/tests/jdb.1_queries.html.php (modified) (3 diffs)
- trunk/testapp/modules/jelix_tests/tests/jdb.1_queries.html.php (modified) (3 diffs)
- trunk/testapp/modules/jelix_tests/tests/jdb.pgsql.html.php (modified) (3 diffs)
- trunk/testapp/modules/jelix_tests/tests/jdb.pgsql.html.php (modified) (3 diffs)
- trunk/testapp/modules/jelix_tests/tests/jdb.sqlite.html.php (added)
- trunk/testapp/modules/jelix_tests/tests/jdb.sqlite.html.php (added)
- trunk/testapp/var/config/dbprofils.ini.php.dist (modified) (1 diff)
- trunk/testapp/var/config/dbprofils.ini.php.dist (modified) (1 diff)
- trunk/testapp/var/db (added)
- trunk/testapp/var/db (added)
- trunk/testapp/var/db/sqlite (added)
- trunk/testapp/var/db/sqlite (added)
- trunk/testapp/var/db/sqlite/tests.sqlite (added)
- trunk/testapp/var/db/sqlite/tests.sqlite (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build/manifests/testapp.mn
r639 r640 122 122 jdb.2_queries_with_pdo.html.php 123 123 jdb.pgsql.html.php 124 jdb.sqlite.html.php 124 125 jforms.html.php 125 126 jforms.check_datas.html.php … … 152 153 cd testapp/var/overloads/testapp/daos 153 154 cd testapp/var/overloads/testapp/locales 155 cd testapp/var/db/sqlite/ 156 tests.sqlite 154 157 155 158 cd temp/testapp trunk/build/manifests/testapp.mn
r639 r640 122 122 jdb.2_queries_with_pdo.html.php 123 123 jdb.pgsql.html.php 124 jdb.sqlite.html.php 124 125 jforms.html.php 125 126 jforms.check_datas.html.php … … 152 153 cd testapp/var/overloads/testapp/daos 153 154 cd testapp/var/overloads/testapp/locales 155 cd testapp/var/db/sqlite/ 156 tests.sqlite 154 157 155 158 cd temp/testapp trunk/lib/jelix-scripts/commands/createdao.cmd.php
r639 r640 136 136 $primarykeys.=$fieldname; 137 137 } 138 if($prop->notNull && !$prop->auto _increment)138 if($prop->notNull && !$prop->autoIncrement) 139 139 $properties.=' required="true"'; 140 141 if($prop->hasDefault) { 142 $properties.=' default="'.htmlspecialchars($prop->default).'"'; 143 } 144 if ($prop->length) { 145 $properties.=' maxlength="'.$prop->length.'"'; 146 } 140 147 $properties.='/>'; 141 148 } trunk/lib/jelix-scripts/commands/createdao.cmd.php
r639 r640 136 136 $primarykeys.=$fieldname; 137 137 } 138 if($prop->notNull && !$prop->auto _increment)138 if($prop->notNull && !$prop->autoIncrement) 139 139 $properties.=' required="true"'; 140 141 if($prop->hasDefault) { 142 $properties.=' default="'.htmlspecialchars($prop->default).'"'; 143 } 144 if ($prop->length) { 145 $properties.=' maxlength="'.$prop->length.'"'; 146 } 140 147 $properties.='/>'; 141 148 } trunk/lib/jelix/dao/jDaoGenerator.class.php
r638 r640 91 91 foreach ($this->_datasParser->getProperties() as $id=>$field){ 92 92 $properties[$id] = get_object_vars($field); 93 $src[] =' public $'.$id.';'; 93 if($field->defaultValue !== null) 94 $src[] =' public $'.$id.'='.var_export($field->defaultValue, true).';'; 95 else 96 $src[] =' public $'.$id.';'; 94 97 } 95 98 trunk/lib/jelix/dao/jDaoGenerator.class.php
r638 r640 91 91 foreach ($this->_datasParser->getProperties() as $id=>$field){ 92 92 $properties[$id] = get_object_vars($field); 93 $src[] =' public $'.$id.';'; 93 if($field->defaultValue !== null) 94 $src[] =' public $'.$id.'='.var_export($field->defaultValue, true).';'; 95 else 96 $src[] =' public $'.$id.';'; 94 97 } 95 98 trunk/lib/jelix/dao/jDaoParser.class.php
r639 r640 281 281 public $ofPrimaryTable = true; 282 282 283 public $defaultValue = null; 283 284 /** 284 285 * constructor. … … 286 287 function __construct ($aParams, $def){ 287 288 $needed = array('name', 'fieldname', 'table', 'datatype', 'required', 'minlength', 288 'maxlength', 'regexp', 'sequence' );289 'maxlength', 'regexp', 'sequence', 'default'); 289 290 290 291 $params = $def->getAttr($aParams, $needed); … … 313 314 $this->minlength = $params['minlength'] !== null ? intval($params['minlength']) : null; 314 315 $this->regExp = $params['regexp']; 315 316 316 317 317 if ($params['datatype']===null){ … … 341 341 $this->required = false; 342 342 $this->requiredInConditions = true; 343 } 344 345 if($params['default'] !== null) { 346 switch($this->datatype) { 347 case 'autoincrement': 348 case 'int': 349 case 'integer': 350 $this->defaultValue = intval($params['default']); 351 break; 352 case 'double': 353 case 'float': 354 $this->defaultValue = doubleval($params['default']); 355 break; 356 default: 357 $this->defaultValue = $params['default']; 358 } 343 359 } 344 360 trunk/lib/jelix/dao/jDaoParser.class.php
r639 r640 281 281 public $ofPrimaryTable = true; 282 282 283 public $defaultValue = null; 283 284 /** 284 285 * constructor. … … 286 287 function __construct ($aParams, $def){ 287 288 $needed = array('name', 'fieldname', 'table', 'datatype', 'required', 'minlength', 288 'maxlength', 'regexp', 'sequence' );289 'maxlength', 'regexp', 'sequence', 'default'); 289 290 290 291 $params = $def->getAttr($aParams, $needed); … … 313 314 $this->minlength = $params['minlength'] !== null ? intval($params['minlength']) : null; 314 315 $this->regExp = $params['regexp']; 315 316 316 317 317 if ($params['datatype']===null){ … … 341 341 $this->required = false; 342 342 $this->requiredInConditions = true; 343 } 344 345 if($params['default'] !== null) { 346 switch($this->datatype) { 347 case 'autoincrement': 348 case 'int': 349 case 'integer': 350 $this->defaultValue = intval($params['default']); 351 break; 352 case 'double': 353 case 'float': 354 $this->defaultValue = doubleval($params['default']); 355 break; 356 default: 357 $this->defaultValue = $params['default']; 358 } 343 359 } 344 360 trunk/lib/jelix/plugins/db/mysql/mysql.dbtools.php
r639 r640 28 28 function _getTableList (){ 29 29 $results = array (); 30 30 31 31 $rs = $this->_connector->query ('SHOW TABLES FROM '.$this->_connector->profil['database']); 32 32 $col_name = 'Tables_in_'.$this->_connector->profil['database']; 33 33 34 34 while ($line = $rs->fetch ()){ 35 35 $results[] = $line->$col_name; 36 36 } 37 37 38 38 return $results; 39 39 } … … 45 45 function _getFieldList ($tableName){ 46 46 $results = array (); 47 47 48 48 $rs = $this->_connector->query ('SHOW FIELDS FROM ' . $tableName); 49 49 50 50 while ($line = $rs->fetch ()){ 51 51 $field = new jDbFieldProperties(); 52 preg_match('/^(\w+).*$/',$line->Type,$m); 53 $field->type = $m[1]; 52 53 if (preg_match('/^(\w+)\s*(\((\d+)\))?.*$/',$line->Type,$m)) { 54 $field->type = strtolower($m[1]); 55 if ($field->type == 'varchar' && isset($m[3])) { 56 $field->length = intval($m[3]); 57 } 58 } else { 59 $field->type = $line->Type; 60 } 61 54 62 $field->name = $line->Field; 55 63 $field->notNull = ($line->Null == 'NO'); trunk/lib/jelix/plugins/db/mysql/mysql.dbtools.php
r639 r640 28 28 function _getTableList (){ 29 29 $results = array (); 30 30 31 31 $rs = $this->_connector->query ('SHOW TABLES FROM '.$this->_connector->profil['database']); 32 32 $col_name = 'Tables_in_'.$this->_connector->profil['database']; 33 33 34 34 while ($line = $rs->fetch ()){ 35 35 $results[] = $line->$col_name; 36 36 } 37 37 38 38 return $results; 39 39 } … … 45 45 function _getFieldList ($tableName){ 46 46 $results = array (); 47 47 48 48 $rs = $this->_connector->query ('SHOW FIELDS FROM ' . $tableName); 49 49 50 50 while ($line = $rs->fetch ()){ 51 51 $field = new jDbFieldProperties(); 52 preg_match('/^(\w+).*$/',$line->Type,$m); 53 $field->type = $m[1]; 52 53 if (preg_match('/^(\w+)\s*(\((\d+)\))?.*$/',$line->Type,$m)) { 54 $field->type = strtolower($m[1]); 55 if ($field->type == 'varchar' && isset($m[3])) { 56 $field->length = intval($m[3]); 57 } 58 } else { 59 $field->type = $line->Type; 60 } 61 54 62 $field->name = $line->Field; 55 63 $field->notNull = ($line->Null == 'NO'); trunk/lib/jelix/plugins/db/pgsql/pgsql.dbconnection.php
r631 r640 64 64 65 65 protected function _connect (){ 66 $funcconnect= ( $this->profil['persistent'] ? 'pg_pconnect':'pg_connect');66 $funcconnect= (isset($this->profil['persistent']) && $this->profil['persistent'] ? 'pg_pconnect':'pg_connect'); 67 67 68 68 $str = ''; trunk/lib/jelix/plugins/db/pgsql/pgsql.dbconnection.php
r631 r640 64 64 65 65 protected function _connect (){ 66 $funcconnect= ( $this->profil['persistent'] ? 'pg_pconnect':'pg_connect');66 $funcconnect= (isset($this->profil['persistent']) && $this->profil['persistent'] ? 'pg_pconnect':'pg_connect'); 67 67 68 68 $str = ''; trunk/lib/jelix/plugins/db/pgsql/pgsql.dbtools.php
r639 r640 54 54 55 55 // get field informations 56 $sql_get_fields = "SELECT t.typname, a.attname, a.attnotnull, a.attnum, 56 $sql_get_fields = "SELECT t.typname, a.attname, a.attnotnull, a.attnum, a.attlen, a.atttypmod, 57 57 a.atthasdef, d.adsrc 58 58 FROM pg_type t, pg_attribute a LEFT JOIN pg_attrdef d ON (d.adrelid=a.attrelid AND d.adnum=a.attnum) … … 60 60 a.attnum > 0 AND a.attrelid = ".$table->oid." AND a.atttypid = t.oid 61 61 ORDER BY a.attnum"; 62 62 63 63 $toReturn=array(); 64 64 $rs = $this->_connector->query ($sql_get_fields); … … 75 75 $field->default = ''; 76 76 } 77 77 78 78 if(in_array($line->attnum, $pkeys)) 79 79 $field->primary = true; 80 80 81 if($line->attlen == -1 && $line->atttypmod != -1) 82 $field->length = $line->atttypmod - 4; 83 81 84 $toReturn[$line->attname]=$field; 82 85 } trunk/lib/jelix/plugins/db/pgsql/pgsql.dbtools.php
r639 r640 54 54 55 55 // get field informations 56 $sql_get_fields = "SELECT t.typname, a.attname, a.attnotnull, a.attnum, 56 $sql_get_fields = "SELECT t.typname, a.attname, a.attnotnull, a.attnum, a.attlen, a.atttypmod, 57 57 a.atthasdef, d.adsrc 58 58 FROM pg_type t, pg_attribute a LEFT JOIN pg_attrdef d ON (d.adrelid=a.attrelid AND d.adnum=a.attnum) … … 60 60 a.attnum > 0 AND a.attrelid = ".$table->oid." AND a.atttypid = t.oid 61 61 ORDER BY a.attnum"; 62 62 63 63 $toReturn=array(); 64 64 $rs = $this->_connector->query ($sql_get_fields); … … 75 75 $field->default = ''; 76 76 } 77 77 78 78 if(in_array($line->attnum, $pkeys)) 79 79 $field->primary = true; 80 80 81 if($line->attlen == -1 && $line->atttypmod != -1) 82 $field->length = $line->atttypmod - 4; 83 81 84 $toReturn[$line->attname]=$field; 82 85 } trunk/lib/jelix/plugins/db/sqlite/sqlite.dbconnection.php
r629 r640 61 61 62 62 protected function _connect (){ 63 $funcconnect= ( $this->profil['persistent']? 'sqlite_popen':'sqlite_open');63 $funcconnect= (isset($this->profil['persistent']) && $this->profil['persistent']? 'sqlite_popen':'sqlite_open'); 64 64 if ($cnx = @$funcconnect(JELIX_APP_VAR_PATH. 'db/sqlite/'.$this->profil['database'])) { 65 65 return $cnx; trunk/lib/jelix/plugins/db/sqlite/sqlite.dbconnection.php
r629 r640 61 61 62 62 protected function _connect (){ 63 $funcconnect= ( $this->profil['persistent']? 'sqlite_popen':'sqlite_open');63 $funcconnect= (isset($this->profil['persistent']) && $this->profil['persistent']? 'sqlite_popen':'sqlite_open'); 64 64 if ($cnx = @$funcconnect(JELIX_APP_VAR_PATH. 'db/sqlite/'.$this->profil['database'])) { 65 65 return $cnx; trunk/lib/jelix/plugins/db/sqlite/sqlite.dbtools.php
r639 r640 4 4 * @subpackage db_driver 5 5 * @author Loic Mathaud 6 * @contributor 7 * @copyright 2006 Loic Mathaud 6 * @contributor Laurent Jouanneau 7 * @copyright 2006 Loic Mathaud, 2007 Laurent Jouanneau 8 8 * @link http://www.jelix.org 9 9 * @licence http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file … … 16 16 */ 17 17 class sqliteDbTools extends jDbTools { 18 function __construct($connector){19 parent::__construct($connector);20 }21 18 22 19 /** … … 24 21 * @return array $tab[] = $nomDeTable 25 22 */ 26 function _getTableList (){23 protected function _getTableList (){ 27 24 $results = array (); 28 25 … … 40 37 * @return array $tab[NomDuChamp] = obj avec prop (tye, length, lengthVar, notnull) 41 38 */ 42 function _getFieldList ($tableName){39 protected function _getFieldList ($tableName) { 43 40 $results = array (); 44 45 $query = "SELECT sql FROM sqlite_master WHERE tbl_name= '". $tableName ."'";46 $rs = $this->_connector->query($query);47 $rs_line = $rs->fetch();48 $create_table = $rs_line->sql;49 41 50 42 $query = "PRAGMA table_info(". sqlite_escape_string($tableName) .")"; 51 43 $rs = $this->_connector->query($query); 44 while ($line = $rs->fetch()) { 45 $field = new jDbFieldProperties(); 46 $field->name = $line->name; 47 $field->primary = ($line->pk == 1); 48 $field->notNull = ($line->notnull == '99' || $line->pk == 1); 52 49 53 while ($result_line = $rs->fetch()){ 54 $field = new jDbFieldProperties(); 50 if (preg_match('/^(\w+)\s*(\((\d+)\))?.*$/',$line->type,$m)) { 51 $field->type = strtolower($m[1]); 52 if (isset($m[3])) { 53 $field->length = intval($m[3]); 54 } 55 } 56 else { 57 $field->type = $line->type; 58 } 55 59 56 $type = $result_line->type; 57 58 /** 59 * récupéré depuis phpMyAdmin 60 */ 61 // set or enum types: slashes single quotes inside options 62 $type = str_replace('BINARY', '', $type); 63 $type = str_replace('ZEROFILL', '', $type); 64 $type = str_replace('UNSIGNED', '', $type); 65 /* 66 if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)){ 67 $type = $tmp[1]; 68 $length = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1); 69 }else{ 70 $length = $type; 71 $type = chop(eregi_replace('\\(.*\\)', '', $type)); 72 if (!empty($type)){ 73 $length = eregi_replace("^$type\(", '', $length); 74 $length = eregi_replace('\)$', '', trim($length)); 60 if ($field->type == 'integer' && $field->primary) { 61 $field->autoIncrement = true; 62 } 63 if (!$field->primary) { 64 if ($line->dflt_value !== null || ($line->dflt_value === null && !$field->notNull)) { 65 $field->hasDefault = true; 66 $field->default = $line->dflt_value; 75 67 } 76 if ($length == $type){77 $length = '';78 }79 }*/80 81 preg_match('/^(\w+).*$/',$type,$m);82 83 $field->type = strtolower($m[1]);84 $field->name = $result_line->name;85 //$p_result_line->length = $length;86 $field->notNull = ($result_line->notnull != 1);87 $field->primary = ($result_line->pk == 1);88 89 if (preg_match('/^int/i', $field->type)) {90 if ($field->primary) {91 $field->autoIncrement = true;92 } else {93 $str = stristr($create_table, $field->name);94 $array = explode(',', $str);95 if (preg_match('/autoincrement/i', $array[0])) {96 $field->autoIncrement = true;97 } else {98 $field->autoIncrement = false;99 }100 }101 } else {102 $field->autoIncrement = false;103 68 } 104 $results[$ result_line->name] = $field;69 $results[$line->name] = $field; 105 70 } 106 71 return $results; trunk/lib/jelix/plugins/db/sqlite/sqlite.dbtools.php
r639 r640 4 4 * @subpackage db_driver 5 5 * @author Loic Mathaud 6 * @contributor 7 * @copyright 2006 Loic Mathaud 6 * @contributor Laurent Jouanneau 7 * @copyright 2006 Loic Mathaud, 2007 Laurent Jouanneau 8 8 * @link http://www.jelix.org 9 9 * @licence http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file … … 16 16 */ 17 17 class sqliteDbTools extends jDbTools { 18 function __construct($connector){19 parent::__construct($connector);20 }21 18 22 19 /** … … 24 21 * @return array $tab[] = $nomDeTable 25 22 */ 26 function _getTableList (){23 protected function _getTableList (){ 27 24 $results = array (); 28 25 … … 40 37 * @return array $tab[NomDuChamp] = obj avec prop (tye, length, lengthVar, notnull) 41 38 */ 42 function _getFieldList ($tableName){39 protected function _getFieldList ($tableName) { 43 40 $results = array (); 44 45 $query = "SELECT sql FROM sqlite_master WHERE tbl_name= '". $tableName ."'";46 $rs = $this->_connector->query($query);47 $rs_line = $rs->fetch();48 $create_table = $rs_line->sql;49 41 50 42 $query = "PRAGMA table_info(". sqlite_escape_string($tableName) .")"; 51 43 $rs = $this->_connector->query($query); 44 while ($line = $rs->fetch()) { 45 $field = new jDbFieldProperties(); 46 $field->name = $line->name; 47 $field->primary = ($line->pk == 1); 48 $field->notNull = ($line->notnull == '99' || $line->pk == 1); 52 49 53 while ($result_line = $rs->fetch()){ 54 $field = new jDbFieldProperties(); 50 if (preg_match('/^(\w+)\s*(\((\d+)\))?.*$/',$line->type,$m)) { 51 $field->type = strtolower($m[1]); 52 if (isset($m[3])) { 53 $field->length = intval($m[3]); 54 } 55 } 56 else { 57 $field->type = $line->type; 58 } 55 59 56 $type = $result_line->type; 57 58 /** 59 * récupéré depuis phpMyAdmin 60 */ 61 // set or enum types: slashes single quotes inside options 62 $type = str_replace('BINARY', '', $type); 63 $type = str_replace('ZEROFILL', '', $type); 64 $type = str_replace('UNSIGNED', '', $type); 65 /* 66 if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)){ 67 $type = $tmp[1]; 68 $length = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1); 69 }else{ 70 $length = $type; 71 $type = chop(eregi_replace('\\(.*\\)', '', $type)); 72 if (!empty($type)){ 73 $length = eregi_replace("^$type\(", '', $length); 74 $length = eregi_replace('\)$', '', trim($length)); 60 if ($field->type == 'integer' && $field->primary) { 61 $field->autoIncrement = true; 62 } 63 if (!$field->primary) { 64 if ($line->dflt_value !== null || ($line->dflt_value === null && !$field->notNull)) { 65 $field->hasDefault = true; 66 $field->default = $line->dflt_value; 75 67 } 76 if ($length == $type){77 $length = '';78 }79 }*/80 81 preg_match('/^(\w+).*$/',$type,$m);82 83 $field->type = strtolower($m[1]);84 $field->name = $result_line->name;85 //$p_result_line->length = $length;86 $field->notNull = ($result_line->notnull != 1);87 $field->primary = ($result_line->pk == 1);88 89 if (preg_match('/^int/i', $field->type)) {90 if ($field->primary) {91 $field->autoIncrement = true;92 } else {93 $str = stristr($create_table, $field->name);94 $array = explode(',', $str);95 if (preg_match('/autoincrement/i', $array[0])) {96 $field->autoIncrement = true;97 } else {98 $field->autoIncrement = false;99 }100 }101 } else {102 $field->autoIncrement = false;103 68 } 104 $results[$ result_line->name] = $field;69 $results[$line->name] = $field; 105 70 } 106 71 return $results; trunk/testapp/modules/jelix_tests/daos/products.dao.xml
r628 r640 7 7 <property name="id" fieldname="id" datatype="autoincrement"/> 8 8 <property name="name" fieldname="name" datatype="string" required="true"/> 9 <property name="price" fieldname="price" datatype="float" />9 <property name="price" fieldname="price" datatype="float" default="0"/> 10 10 <property name="create_date" fieldname="create_date" datatype="datetime" insertpattern="NOW()"/> 11 11 </record> trunk/testapp/modules/jelix_tests/daos/products.dao.xml
r628 r640 7 7 <property name="id" fieldname="id" datatype="autoincrement"/> 8 8 <property name="name" fieldname="name" datatype="string" required="true"/> 9 <property name="price" fieldname="price" datatype="float" />9 <property name="price" fieldname="price" datatype="float" default="0"/> 10 10 <property name="create_date" fieldname="create_date" datatype="datetime" insertpattern="NOW()"/> 11 11 </record> trunk/testapp/modules/jelix_tests/tests/jdao.parser.html.php
r584 r640 340 340 <null p="maxlength"/> 341 341 <null p="minlength"/> 342 <null p="defaultValue" /> 343 <boolean p="ofPrimaryTable" value="true" /> 344 </object>' 345 ), 346 array( 347 '<?xml version="1.0"?> 348 <property name="label" datatype="string" default="no label"/>', 349 '<?xml version="1.0"?> 350 <object> 351 <string p="name" value="label"/> 352 <string p="fieldName" value="label"/> 353 <string p="table" value="news"/> 354 <string p="datatype" value="string"/> 355 <null p="regExp"/> 356 <boolean p="required" value="false"/> 357 <boolean p="requiredInConditions" value="false"/> 358 <boolean p="isPK" value="false" /> 359 <boolean p="isFK" value="false" /> 360 <string p="updatePattern" value="%s" /> 361 <string p="insertPattern" value="%s" /> 362 <string p="selectPattern" value="%s" /> 363 <string p="sequenceName" value="" /> 364 <null p="maxlength"/> 365 <null p="minlength"/> 366 <string p="defaultValue" value="no label" /> 342 367 <boolean p="ofPrimaryTable" value="true" /> 343 368 </object>' trunk/testapp/modules/jelix_tests/tests/jdao.parser.html.php
r584 r640 340 340 <null p="maxlength"/> 341 341 <null p="minlength"/> 342 <null p="defaultValue" /> 343 <boolean p="ofPrimaryTable" value="true" /> 344 </object>' 345 ), 346 array( 347 '<?xml version="1.0"?> 348 <property name="label" datatype="string" default="no label"/>', 349 '<?xml version="1.0"?> 350 <object> 351 <string p="name" value="label"/> 352 <string p="fieldName" value="label"/> 353 <string p="table" value="news"/> 354 <string p="datatype" value="string"/> 355 <null p="regExp"/> 356 <boolean p="required" value="false"/> 357 <boolean p="requiredInConditions" value="false"/> 358 <boolean p="isPK" value="false" /> 359 <boolean p="isFK" value="false" /> 360 <string p="updatePattern" value="%s" /> 361 <string p="insertPattern" value="%s" /> 362 <string p="selectPattern" value="%s" /> 363 <string p="sequenceName" value="" /> 364 <null p="maxlength"/> 365 <null p="minlength"/> 366 <string p="defaultValue" value="no label" /> 342 367 <boolean p="ofPrimaryTable" value="true" /> 343 368 </object>' trunk/testapp/modules/jelix_tests/tests/jdb.1_queries.html.php
r639 r640 127 127 <boolean property="hasDefault" value="false" /> 128 128 <null property="default" /> 129 <integer property="length" value="0" /> 129 130 </object> 130 131 <object key="name" class="jDbFieldProperties"> … … 136 137 <boolean property="hasDefault" value="false" /> 137 138 <string property="default" value="" /> 139 <integer property="length" value="150" /> 138 140 </object> 139 141 <object key="price" class="jDbFieldProperties"> … … 145 147 <boolean property="hasDefault" value="true" /> 146 148 <string property="default" value="0" /> 149 <integer property="length" value="0" /> 147 150 </object> 148 151 </array>'; trunk/testapp/modules/jelix_tests/tests/jdb.1_queries.html.php
r639 r640 127 127 <boolean property="hasDefault" value="false" /> 128 128 <null property="default" /> 129 <integer property="length" value="0" /> 129 130 </object> 130 131 <object key="name" class="jDbFieldProperties"> … … 136 137 <boolean property="hasDefault" value="false" /> 137 138 <string property="default" value="" /> 139 <integer property="length" value="150" /> 138 140 </object> 139 141 <object key="price" class="jDbFieldProperties"> … … 145 147 <boolean property="hasDefault" value="true" /> 146 148 <string property="default" value="0" /> 149 <integer property="length" value="0" /> 147 150 </object> 148 151 </array>'; trunk/testapp/modules/jelix_tests/tests/jdb.pgsql.html.php
r639 r640 31 31 <boolean property="hasDefault" value="true" /> 32 32 <string property="default" value="" /> 33 <integer property="length" value="0" /> 33 34 </object> 34 35 <object key="name" class="jDbFieldProperties"> … … 40 41 <boolean property="hasDefault" value="false" /> 41 42 <null property="default" /> 43 <integer property="length" value="150" /> 42 44 </object> 43 45 <object key="price" class="jDbFieldProperties"> … … 49 51 <boolean property="hasDefault" value="true" /> 50 52 <string property="default" value="0" /> 53 <integer property="length" value="0" /> 51 54 </object> 52 55 </array>'; trunk/testapp/modules/jelix_tests/tests/jdb.pgsql.html.php
