public function readDatabase() { php_Lib::println("Connecting to database..."); $cnx = php_db_Mysql::connect(_hx_anonymous(array("host" => "localhost", "port" => 8889, "user" => "root", "pass" => "root", "socket" => null, "database" => "RODictionary"))); php_Lib::println("Connected succesfully!"); $sourcesResult = $cnx->request("SELECT * FROM Source"); $startTime = haxe_Timer::stamp(); $rset = $cnx->request("SELECT * FROM Definition LIMIT 50"); php_Lib::println("Found " . $rset->getLength() . " lexicons, and took " . (haxe_Timer::stamp() - $startTime) . " seconds"); $this->writeXml($rset); $cnx->close(); }
static function main() { $files = sys_FileSystem::readDirectory("../images"); $validimages = new _hx_array(array()); $_g = 0; while ($_g < $files->length) { $it = $files[$_g]; ++$_g; if (StringTools::endsWith($it, ".jpg") === true) { $validimages->push($it); } else { if (StringTools::endsWith($it, ".png") === true) { $validimages->push($it); } else { if (StringTools::endsWith($it, ".gif") === true) { $validimages->push($it); } } } unset($it); } php_Lib::println(haxe_Json::stringify($validimages, null)); }
static function dump($d) { if (!S::$headerSent) { header("Content-Type" . ": " . "application/json"); S::$headerSent = true; } php_Lib::println(haxe_Json::phpJsonEncode($d, null, null)); }