mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-01 05:20:55 +02:00
addressbook
admin
calendar
doc
etemplate
filemanager
files
home
importexport
infolog
mail
notifications
phpgwapi
cron
doc
images
inc
adodb
contrib
cute_icons_for_site
datadict
datadict-access.inc.php
datadict-db2.inc.php
datadict-firebird.inc.php
datadict-generic.inc.php
datadict-ibase.inc.php
datadict-informix.inc.php
datadict-mssql.inc.php
datadict-mysql.inc.php
datadict-oci8.inc.php
datadict-postgres.inc.php
datadict-sapdb.inc.php
datadict-sybase.inc.php
docs
drivers
lang
pear
perf
session
xsl
adodb-csvlib.inc.php
adodb-datadict.inc.php
adodb-error.inc.php
adodb-errorhandler.inc.php
adodb-errorpear.inc.php
adodb-exceptions.inc.php
adodb-iterator.inc.php
adodb-lib.inc.php
adodb-pager.inc.php
adodb-pear.inc.php
adodb-perf.inc.php
adodb-php4.inc.php
adodb-time.inc.php
adodb-time.zip
adodb-xmlschema.inc.php
adodb.inc.php
license.txt
pivottable.inc.php
readme.txt
rsfilter.inc.php
server.php
toexport.inc.php
tohtml.inc.php
xmlschema.dtd
horde
htmLawed
idna_convert
min
savant2
class.Template.inc.php
class.about.inc.php
class.accounts.inc.php
class.accounts_ads.inc.php
class.accounts_ldap.inc.php
class.accounts_sql.inc.php
class.acl.inc.php
class.applications.inc.php
class.arrayfunctions.inc.php
class.asyncservice.inc.php
class.auth.inc.php
class.auth_ads.inc.php
class.auth_cas.inc.php
class.auth_fallback.inc.php
class.auth_fallbackmail2sql.inc.php
class.auth_http.inc.php
class.auth_ldap.inc.php
class.auth_mail.inc.php
class.auth_nis.inc.php
class.auth_pam.inc.php
class.auth_sql.inc.php
class.auth_sqlssl.inc.php
class.bolink.inc.php
class.categories.inc.php
class.common.inc.php
class.config.inc.php
class.contacts.inc.php
class.contenthistory.inc.php
class.country.inc.php
class.db_backup.inc.php
class.egw.inc.php
class.egw_cache.inc.php
class.egw_cache_apc.inc.php
class.egw_cache_files.inc.php
class.egw_cache_memcache.inc.php
class.egw_cache_xcache.inc.php
class.egw_ckeditor_config.inc.php
class.egw_csrf.inc.php
class.egw_customfields.inc.php
class.egw_datetime.inc.php
class.egw_db.inc.php
class.egw_digest_auth.inc.php
class.egw_exception.inc.php
class.egw_favorites.inc.php
class.egw_find_iterator.inc.php
class.egw_framework.inc.php
class.egw_grid_columns.inc.php
class.egw_htmLawed.inc.php
class.egw_ical_iterator.inc.php
class.egw_idna.inc.php
class.egw_include_mgr.inc.php
class.egw_index.inc.php
class.egw_json.inc.php
class.egw_keymanager.inc.php
class.egw_link.inc.php
class.egw_mailer.inc.php
class.egw_session.inc.php
class.egw_session_files.inc.php
class.egw_session_memcache.inc.php
class.egw_tail.inc.php
class.egw_time.inc.php
class.egw_vfs.inc.php
class.error.inc.php
class.errorlog.inc.php
class.filesystem_stream_wrapper.inc.php
class.global_stream_wrapper.inc.php
class.groupdav.inc.php
class.groupdav_handler.inc.php
class.groupdav_hooks.inc.php
class.groupdav_principals.inc.php
class.historylog.inc.php
class.hooks.inc.php
class.html.inc.php
class.iface_stream_wrapper.inc.php
class.ischedule_client.inc.php
class.ischedule_server.inc.php
class.jscalendar.inc.php
class.ldap.inc.php
class.ldapserverinfo.inc.php
class.links_stream_wrapper.inc.php
class.listbox.inc.php
class.log.inc.php
class.mailDomainSigner.inc.php
class.mime_magic.inc.php
class.network.inc.php
class.nextmatchs.inc.php
class.phpmailer.inc.php
class.portalbox.inc.php
class.preferences.inc.php
class.resultbox.inc.php
class.schema_proc.inc.php
class.send.inc.php
class.smtp.php
class.solink.inc.php
class.sqlfs_stream_wrapper.inc.php
class.sqlfs_utils.inc.php
class.tplsavant2.inc.php
class.translation.inc.php
class.uiaccountsel.inc.php
class.vfs_home_hooks.inc.php
class.vfs_stream_wrapper.inc.php
class.vfs_webdav_server.inc.php
common_functions.inc.php
functions.inc.php
jscalendar-setup.php
js
lang
ntlm
setup
templates
templatesSavant2
tests
addressbook.php
config.php
images.php
ischedule-cli.php
ischedule.php
lang.php
user.php
preferences
resources
setup
timesheet
.htaccess
about.php
groupdav.htaccess
groupdav.php
header.inc.php.template
index.php
json.php
login.php
logout.php
redirect.php
remote.php
rpc.php
set_box.php
status.php
svn-helper.php
webdav.php
228 lines
5.7 KiB
PHP
228 lines
5.7 KiB
PHP
<?php
|
|
|
|
/**
|
|
V4.65 22 July 2005 (c) 2000-2005 John Lim (jlim@natsoft.com.my). All rights reserved.
|
|
Released under both BSD license and Lesser GPL library license.
|
|
Whenever there is any discrepancy between the two licenses,
|
|
the BSD license will take precedence.
|
|
|
|
Set tabs to 4 for best viewing.
|
|
|
|
*/
|
|
|
|
// security - hide paths
|
|
if (!defined('ADODB_DIR')) die();
|
|
|
|
class ADODB2_sybase extends ADODB_DataDict {
|
|
var $databaseType = 'sybase';
|
|
|
|
var $dropIndex = 'DROP INDEX %2$s.%1$s';
|
|
|
|
function MetaType($t,$len=-1,$fieldobj=false)
|
|
{
|
|
if (is_object($t)) {
|
|
$fieldobj = $t;
|
|
$t = $fieldobj->type;
|
|
$len = $fieldobj->max_length;
|
|
}
|
|
|
|
$len = -1; // mysql max_length is not accurate
|
|
switch (strtoupper($t)) {
|
|
|
|
case 'INT':
|
|
case 'INTEGER': return 'I';
|
|
case 'BIT':
|
|
case 'TINYINT': return 'I1';
|
|
case 'SMALLINT': return 'I2';
|
|
case 'BIGINT': return 'I8';
|
|
|
|
case 'REAL':
|
|
case 'FLOAT': return 'F';
|
|
default: return parent::MetaType($t,$len,$fieldobj);
|
|
}
|
|
}
|
|
|
|
function ActualType($meta)
|
|
{
|
|
switch(strtoupper($meta)) {
|
|
case 'C': return 'VARCHAR';
|
|
case 'XL':
|
|
case 'X': return 'TEXT';
|
|
|
|
case 'C2': return 'NVARCHAR';
|
|
case 'X2': return 'NTEXT';
|
|
|
|
case 'B': return 'IMAGE';
|
|
|
|
case 'D': return 'DATETIME';
|
|
case 'T': return 'DATETIME';
|
|
case 'L': return 'BIT';
|
|
|
|
case 'I': return 'INT';
|
|
case 'I1': return 'TINYINT';
|
|
case 'I2': return 'SMALLINT';
|
|
case 'I4': return 'INT';
|
|
case 'I8': return 'BIGINT';
|
|
|
|
case 'F': return 'REAL';
|
|
case 'N': return 'NUMERIC';
|
|
default:
|
|
return $meta;
|
|
}
|
|
}
|
|
|
|
|
|
function AddColumnSQL($tabname, $flds)
|
|
{
|
|
$tabname = $this->TableName ($tabname);
|
|
$f = array();
|
|
list($lines,$pkey) = $this->_GenFields($flds);
|
|
$s = "ALTER TABLE $tabname $this->addCol";
|
|
foreach($lines as $v) {
|
|
$f[] = "\n $v";
|
|
}
|
|
$s .= implode(', ',$f);
|
|
$sql[] = $s;
|
|
return $sql;
|
|
}
|
|
|
|
function AlterColumnSQL($tabname, $flds)
|
|
{
|
|
$tabname = $this->TableName ($tabname);
|
|
$sql = array();
|
|
list($lines,$pkey) = $this->_GenFields($flds);
|
|
foreach($lines as $v) {
|
|
$sql[] = "ALTER TABLE $tabname $this->alterCol $v";
|
|
}
|
|
|
|
return $sql;
|
|
}
|
|
|
|
function DropColumnSQL($tabname, $flds)
|
|
{
|
|
$tabname = $this->TableName($tabname);
|
|
if (!is_array($flds)) $flds = explode(',',$flds);
|
|
$f = array();
|
|
$s = "ALTER TABLE $tabname";
|
|
foreach($flds as $v) {
|
|
$f[] = "\n$this->dropCol ".$this->NameQuote($v);
|
|
}
|
|
$s .= implode(', ',$f);
|
|
$sql[] = $s;
|
|
return $sql;
|
|
}
|
|
|
|
// return string must begin with space
|
|
function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint)
|
|
{
|
|
$suffix = '';
|
|
if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault";
|
|
if ($fautoinc) $suffix .= ' DEFAULT AUTOINCREMENT';
|
|
if ($fnotnull) $suffix .= ' NOT NULL';
|
|
else if ($suffix == '') $suffix .= ' NULL';
|
|
if ($fconstraint) $suffix .= ' '.$fconstraint;
|
|
return $suffix;
|
|
}
|
|
|
|
/*
|
|
CREATE TABLE
|
|
[ database_name.[ owner ] . | owner. ] table_name
|
|
( { < column_definition >
|
|
| column_name AS computed_column_expression
|
|
| < table_constraint > ::= [ CONSTRAINT constraint_name ] }
|
|
|
|
| [ { PRIMARY KEY | UNIQUE } [ ,...n ]
|
|
)
|
|
|
|
[ ON { filegroup | DEFAULT } ]
|
|
[ TEXTIMAGE_ON { filegroup | DEFAULT } ]
|
|
|
|
< column_definition > ::= { column_name data_type }
|
|
[ COLLATE < collation_name > ]
|
|
[ [ DEFAULT constant_expression ]
|
|
| [ IDENTITY [ ( seed , increment ) [ NOT FOR REPLICATION ] ] ]
|
|
]
|
|
[ ROWGUIDCOL]
|
|
[ < column_constraint > ] [ ...n ]
|
|
|
|
< column_constraint > ::= [ CONSTRAINT constraint_name ]
|
|
{ [ NULL | NOT NULL ]
|
|
| [ { PRIMARY KEY | UNIQUE }
|
|
[ CLUSTERED | NONCLUSTERED ]
|
|
[ WITH FILLFACTOR = fillfactor ]
|
|
[ON {filegroup | DEFAULT} ] ]
|
|
]
|
|
| [ [ FOREIGN KEY ]
|
|
REFERENCES ref_table [ ( ref_column ) ]
|
|
[ ON DELETE { CASCADE | NO ACTION } ]
|
|
[ ON UPDATE { CASCADE | NO ACTION } ]
|
|
[ NOT FOR REPLICATION ]
|
|
]
|
|
| CHECK [ NOT FOR REPLICATION ]
|
|
( logical_expression )
|
|
}
|
|
|
|
< table_constraint > ::= [ CONSTRAINT constraint_name ]
|
|
{ [ { PRIMARY KEY | UNIQUE }
|
|
[ CLUSTERED | NONCLUSTERED ]
|
|
{ ( column [ ASC | DESC ] [ ,...n ] ) }
|
|
[ WITH FILLFACTOR = fillfactor ]
|
|
[ ON { filegroup | DEFAULT } ]
|
|
]
|
|
| FOREIGN KEY
|
|
[ ( column [ ,...n ] ) ]
|
|
REFERENCES ref_table [ ( ref_column [ ,...n ] ) ]
|
|
[ ON DELETE { CASCADE | NO ACTION } ]
|
|
[ ON UPDATE { CASCADE | NO ACTION } ]
|
|
[ NOT FOR REPLICATION ]
|
|
| CHECK [ NOT FOR REPLICATION ]
|
|
( search_conditions )
|
|
}
|
|
|
|
|
|
*/
|
|
|
|
/*
|
|
CREATE [ UNIQUE ] [ CLUSTERED | NONCLUSTERED ] INDEX index_name
|
|
ON { table | view } ( column [ ASC | DESC ] [ ,...n ] )
|
|
[ WITH < index_option > [ ,...n] ]
|
|
[ ON filegroup ]
|
|
< index_option > :: =
|
|
{ PAD_INDEX |
|
|
FILLFACTOR = fillfactor |
|
|
IGNORE_DUP_KEY |
|
|
DROP_EXISTING |
|
|
STATISTICS_NORECOMPUTE |
|
|
SORT_IN_TEMPDB
|
|
}
|
|
*/
|
|
function _IndexSQL($idxname, $tabname, $flds, $idxoptions)
|
|
{
|
|
$sql = array();
|
|
|
|
if ( isset($idxoptions['REPLACE']) || isset($idxoptions['DROP']) ) {
|
|
$sql[] = sprintf ($this->dropIndex, $idxname, $tabname);
|
|
if ( isset($idxoptions['DROP']) )
|
|
return $sql;
|
|
}
|
|
|
|
if ( empty ($flds) ) {
|
|
return $sql;
|
|
}
|
|
|
|
$unique = isset($idxoptions['UNIQUE']) ? ' UNIQUE' : '';
|
|
$clustered = isset($idxoptions['CLUSTERED']) ? ' CLUSTERED' : '';
|
|
|
|
if ( is_array($flds) )
|
|
$flds = implode(', ',$flds);
|
|
$s = 'CREATE' . $unique . $clustered . ' INDEX ' . $idxname . ' ON ' . $tabname . ' (' . $flds . ')';
|
|
|
|
if ( isset($idxoptions[$this->upperName]) )
|
|
$s .= $idxoptions[$this->upperName];
|
|
|
|
$sql[] = $s;
|
|
|
|
return $sql;
|
|
}
|
|
}
|
|
?>
|