Esempio n. 1
0
 public static function showFieldsInformation($tableName)
 {
     switch (self::$version) {
         case '2005':
             return "SELECT    fieldName=a.name, \n  \t\t\t\t\t\tfieldType=b.name, \n\t\t\t\t\t\tfieldTypeLength=a.length,\n\t\t\t\t\t    fieldDefault=isnull(e.text,''), \n\t\t\t\t\t    fieldIsnull=case when a.isnullable=1 then 'YES' else 'NO' end, \n\t\t\t\t\t    fieldIdentity=case when COLUMNPROPERTY( a.id,a.name,'IsIdentity')=1 then 'YES' else 'NO' end,\n\t\t\t\t\t    fieldPrimary=case when exists(SELECT 1 FROM sysobjects where xtype='PK' and parent_obj=a.id and name in (\n\t\t\t\t\t    SELECT name FROM sysindexes WHERE indid in(\n\t\t\t\t\t    SELECT indid FROM sysindexkeys WHERE id = a.id AND colid=a.colid\n\t\t\t\t\t    ))) then 'PRI' else '' end,\n\t\t\t\t\t     fieldDesc=isnull(g.[value],'')\n\t\t\t\t\t      FROM syscolumns a left join systypes b on a.xtype=b.xusertype inner join sysobjects d on a.id=d.id  \n\t\t\t\t\t         and d.xtype='U' and  d.name='{$tableName}'\n\t\t\t\t\t           left join syscomments e on a.cdefault=e.id left join sys.extended_properties g on a.id=G.major_id and a.colid=g.minor_id  \n\t\t\t\t\t                 order by a.id,a.colorder";
             break;
         case '2000':
             return "SELECT    fieldName=a.name, \n  \t\t\t\t\t\tfieldType=b.name, \n\t\t\t\t\t\tfieldTypeLength=a.length,\n\t\t\t\t\t    fieldDefault=isnull(e.text,''), \n\t\t\t\t\t    fieldIsnull=case when a.isnullable=1 then 'YES' else 'NO' end, \n\t\t\t\t\t    fieldIdentity=case when COLUMNPROPERTY( a.id,a.name,'IsIdentity')=1 then 'YES' else 'NO' end,\n\t\t\t\t\t    fieldPrimary=case when exists(SELECT 1 FROM sysobjects where xtype='PK' and parent_obj=a.id and name in (\n\t\t\t\t\t    SELECT name FROM sysindexes WHERE indid in(\n\t\t\t\t\t    SELECT indid FROM sysindexkeys WHERE id = a.id AND colid=a.colid\n\t\t\t\t\t    ))) then 'PRI' else '' end,\n\t\t\t\t\t     fieldDesc=isnull(g.[value],'')\n\t\t\t\t\t      FROM syscolumns a left join systypes b on a.xtype=b.xusertype inner join sysobjects d on a.id=d.id  \n\t\t\t\t\t         and d.xtype='U' and  d.name='{$tableName}'\n\t\t\t\t\t           left join syscomments e on a.cdefault=e.id left join sys.extended_properties g on a.id=g.id and a.colid=g.smallid   \n\t\t\t\t\t                 order by a.id,a.colorder";
             break;
         default:
             showDbMsg('error db version');
     }
 }
 public function halt($msg, $sqlerrno = NULL, $sqlerror = NUll)
 {
     showDbMsg($msg, $sqlerrno, $sqlerror);
 }