/** * Get a list (array) of User instances, all users are taken. The list is not ordered. * For disabled users see the $disabled parameter * @param bool $disabled if true all users are get, Even user disabled * @return User[] */ public function getUsers($disabled = true) { if ($disabled) { $condition = "1"; } else { $condition = "enabled IS TRUE"; } $usersDb = $this->operations->getList("id", $condition); /* @var $users User[] */ $users = array(); foreach ($usersDb as $value) { $users[] = User::getUserById($this, $value['id']); } return $users; }
} catch (MysqltcsException $e) { print "Error on insert caught<br/>\n"; print $e->getMessage() . "<br/>\n"; } print "<h2>Multiple insert(value - value2)</h2>\n"; $operations->insert("value,value2", array("'1','aa'", "'2','ba'")); print "<h2>Simple insert(value - value2)</h2>\n"; $operations->insert("value,value2", "'1','bb'"); print "<h2>Id of last insert</h2>\n"; print $id = $operations->getLastId(); print "<h2>Get</h2>\n"; print "obviously you can catch exception if you make a wrong get"; print "<h3>Get 'value2' of {$id}</h3>\n"; print $operations->getValue("value2", "id = {$id}"); print "<h3>Get all data</h3>\n"; $results = $operations->getList("id, value, value2", "1"); // or $results = $operations->getList("*", "1"); print "id-value-value2<br/>\n"; foreach ($results as $value) { print $value['id'] . "-" . $value['value'] . "-" . $value['value2'] . "<br/>\n"; } print "<h2>Escape</h2>\n"; $escape = "wro'ng"; print "<h3>insert without escape of `{$escape}`</h3>\n"; try { $operations->insert("value", "'{$escape}'"); } catch (MysqltcsException $e) { print "Error on insert caught<br/>\n"; print $e->getMessage() . "<br/>\n"; } print "<h3>insert with escape of `{$escape}`</h3>\n";