1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/noalyss_ynh.git synced 2024-09-03 19:46:20 +02:00
noalyss_ynh/sources/dev/SQL/template/script_sql.php
dudjima 3a905a4a87 Update sources 7.01
Update files from sources with last update on noalyss.eu
2018-04-13 18:58:28 +02:00

83 lines
No EOL
2.4 KiB
PHP

<?php echo '&lt;?php '; ?>
/**
* Autogenerated file
* This file is part of NOALYSS.
*
* NOALYSS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php';
require_once NOALYSS_INCLUDE.'/lib/database.class.php';
/**
* <?php echo 'class_'.$this->table_name."_sql.php"."\n"; ?>
*
*@file
*@brief abstract of the table <?php echo $this->schema_name.".".$this->table_name?>
*/
class <?php echo ucwords($this->table_name)."_SQL";?> extends Noalyss_SQL
{
function __construct(Database $p_cn,$p_id=-1)
{
$this->table = "<?php echo $this->schema_name.".".$this->table_name?>";
$this->primary_key = "<?php echo $this->pk?>";
/*
* List of columns
*/
$this->name=array(
<?php
$sep="";
for ($i=0;$i < count($columns);$i++):
print "\t". $sep.'"'.$columns[$i]['column_name'].'"'.'=>'.'"'.$columns[$i]['column_name'].'"';
$sep=",";
printf("\n");
endfor;
?>
);
/*
* Type of columns
*/
$this->type = array(
<?php
$sep="";
for ($i=0;$i < count($columns);$i++):
$type=$columns[$i]['data_type'];
if ( in_array($columns[$i]['data_type'], array('integer','numeric','bigint'))):
$type="numeric";
elseif (in_array($columns[$i]['data_type'], array('character','character varying','text'))):
$type="text";
elseif (in_array($columns[$i]['data_type'], array('timestamp without timezone','timestamp with timezone','date'))):
$type="date";
endif;
print "\t". $sep.'"'.$columns[$i]['column_name'].'"'.'=>'.'"'.$type.'"';
printf("\n");
$sep=",";
endfor;
?> );
$this->default = array(
"<?php echo $this->pk?>" => "auto"
);
$this->date_format = "DD.MM.YYYY";
parent::__construct($p_cn,$p_id);
}
}