public static function get_max_position($path) { $cmd = new SDBCommand("SELECT MAX(position) FROM nodes WHERE path=@path"); $cmd->set('path', $path, SDB::String, self::PathSize); $pos = $cmd->get_one(); return $pos === null ? 0 : $pos; }