- 1
- 2
$id = $this->db->fetchCol('SELECT id FROM data;');
$names = $this->db->fetchCol('SELECT name FROM points INNER JOIN data ON points.id = data.point_id_from;');
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+162
$id = $this->db->fetchCol('SELECT id FROM data;');
$names = $this->db->fetchCol('SELECT name FROM points INNER JOIN data ON points.id = data.point_id_from;');
Zend Db usage
+160
function &GetObject($cls, $p=null, $flags=0)
{ //HIDE($objects,$i,$ext,$n,$v)
static $objects;
if (is_array($cls)) {
$i = null;
foreach($cls as $n=>$v) $i->$n = $v;
$result = &$i;
return $result;
}
if (!($flags&O_NEW) && isset($objects[$cls])) return $objects[$cls];
$ext = new WExtern($cls, 'c');
if (!($flags&O_NEW) && isset($objects[$i=$ext->Id()])) return $objects[$i];
if ($flags&O_INSTANCE) {$x = null; $result = &$x; return $result;}
if (!$ext->Exists()) $ext->Prepare();
if (($flags&O_NOERROR) && !class_exists($ext->c)) {
$co = $ext->c;
$cc = $co{0}.'B'.substr($co,1);
if (($flags&O_NOERROR) && !class_exists($cc)) {
$i = false;
return $i;
} else {
$ext->c = $cc;
}
}
if (!class_exists($ext->c)) {
$co = $ext->c;
$cc = $co{0}.'B'.substr($co,1);
if (!class_exists($cc)) {
$i = false;
return $i;
} else {
$ext->c = $cc;
}
}
$c = $ext->c;
$i = new $c;
if (isset($ext->I) && $ext->I) $i->_I = reset($ext->I); // Instance ID
if (isset($ext->A) && $ext->A) $i->_A = $ext->A; // Alias ID
if (!($flags&O_NEW)) {
$objects[$ext->Id()] = &$i;
if ($ext->Id()!=$cls) $objects[$cls] = &$i;
}
$options = &WConfig::Get('OPTIONS');
if (/*is_a($i, 'wobject')*/ $i instanceof wobject && $options) {
$o = $options;
$c = get_class($i);
do{
$c = strtolower($c);
if (isset($o[$c])) {
$i->o = array_merge($o[$c], isset($i->o) ?$i->o :array());
}
}while($c=get_parent_class($c));
if (isset($ext->A) && isset($o[$ext->A])) $i->o = array_merge(isset($i->o) ?$i->o :array(), $o[$ext->A]);
if ($ext->I && isset($o[$ext->Id()])) $i->o = array_merge(isset($i->o) ?$i->o :array(), $o[$o[$ext->Id()]]);
}
if (is_object($p)) {
if (isset($p->o)) $i->o = array_merge(isset($i->o) ?$i->o :array(), $p->o);
$p = isset($p->c) ? $p->c : null;
}
if (method_exists($i,'Create') && $p!==false) {
call_user_func_array(array(&$i,'Create'), is_array($p) ?$p : (isset($p) ? array($p) : array()));
}
return $i;
}
Одна из базовых функций фремворка.
+124
_videoNum = (byte) (videoNum==0?videoNum:0);
попалось сегодня в исходниках рабочего проекта
+80
m_scrabblerProperties = Utils.loadPropertiesFile(m_args[1]);
if (null != m_scrabblerProperties)
{
System.out.println("Executing DBScrubber with properties file " + m_args[1] + " loaded from the classpath");
}
else
{
try
{
m_scrabblerProperties.load(new FileInputStream(m_args[1]));
System.out.println("Executing DBScrubber with properties file " + m_args[1] + " loaded from the file system");
}
catch (IOException e)
{
System.err.println("Failed to load " + m_args[1] + " from the classpath or the file system");
}
}
Utils.loadPropertiesFile - какая то хитрая поделуха которая ищет файл в кэше. Если он не найден в кэше, то автор видимо хотел попробовать считать файл с диска, но судя по всему оказался оказался дебилом.
+166
foreach ($_GET as $xxx => $rvar) { $$xxx = $rvar; }
может боян конешн
−362
// Если FlowerItem, то ложим продукт в подарки, иначе ложим на склад
Блядь, ну ведь не ложим, а кладем!
+163
if (isset($_GET['last_user']) && (int)$_GET['last_user']){
$last_user = 0;
}else{
$last_user = (int)$_GET['last_user'];
}
no comments.. )
+162
$tmp_arr=array();
$id1_str='';
$root_str='';
foreach($id1 as $id){
$id1_str.=$id['id'].' , ';
if(!isset($tmp_arr[$id['root']])){
$root_str.=$id['root'].' , ';
$tmp_arr[$id['root']]=true;
}
}
это типа такой способ собрать distinct root ids в строку!
не забыть потом откусить хвост ' , '
нормальные герои не ищут легких путей
+996
abstractObject=abstractObject;
Когда я это обнаружила в коде, то упала со стула.
+100
function Encrypt(jstr: String): String;
var
I: Integer;
A: Real;
begin
if Length(jstr) = 0 Then begin
Result := '';
Exit;
end;
A := 0;
for I := 0 To Length(jstr) do
A := A + (Ord(jstr[I]) * Pos(jstr[I],jstr)) / 33;
Result := FormatFloat('0000000000.0000000000',A);
if Pos(',',Result) > 0 then begin
Insert('.',Result,Pos(',',Result));
Delete(Result,Pos(',',Result),1);
end;
end;