public static function get_notice_status_member_ids4notice_ids($notice_ids) { if (!$notice_ids) { return array(); } return \Util_Db::conv_col(\DB::select('notice_id')->from('notice_status')->where('notice_id', 'in', $notice_ids)->execute()->as_array()); }
public static function shell_exec_sql4file($sql_file, $dbname = null) { $command = sprintf('%s < %s', Util_Db::make_mysql_conect_command(true, $dbname), $sql_file); if ($error = Util_Toolkit::shell_exec($command)) { throw new Database_Exception($error); } return true; }
public static function delete_album_image_multiple4album_id($album_id, $with_delete_timeline = false, $limit = 0) { if (!$limit) { $limit = conf('batch.limit.delete.album_image'); } while ($album_image_ids = \Util_Db::conv_col(\DB::select('id')->from('album_image')->where('album_id', $album_id)->limit($limit)->as_assoc()->execute())) { static::delete_album_image_multiple4ids($album_image_ids, $with_delete_timeline); } }
public static function delete_note4member_id($member_id, $limit = 0) { if (!$limit) { $limit = conf('batch.limit.delete.note'); } while ($note_ids = \Util_Db::conv_col(\DB::select('id')->from('note')->where('member_id', $member_id)->limit($limit)->as_assoc()->execute())) { foreach ($note_ids as $note_id) { static::delete_note4id($note_id); } } }
private static function exexute_drop_db($database = null) { if (!self::$absolute_execute && !\Site_Util::check_is_dev_env()) { throw new \FuelException('This task is not work at prod env.'); } if (!$database && !($database = \Util_Db::get_database_name())) { throw new \FuelException('Drop db error: Database name is not set at configs.'); } self::$database = $database; return \DBUtil::shell_exec_drop_database(self::$database); }
public static function exec_db_command4file($sql_file, $dbname = null) { try { $command = sprintf('%s < %s', Util_Db::make_mysql_conect_command(true, $dbname), $sql_file); } catch (FuelException $e) { throw new FuelException($e->getMessage()); } if ($error = Util_Toolkit::shell_exec($command)) { throw new Database_Exception($error); } return true; }
public static function check_properties_updated_without_ignores(\Orm\Model $obj, $ignore_properties) { if (empty($ignore_properties)) { return false; } $ignore_properties = (array) $ignore_properties; $all_properties = \Util_Db::get_columns($obj::get_table_name()); foreach ($all_properties as $property) { if (in_array($property, $ignore_properties)) { continue; } if ($obj->is_changed($property)) { return true; } } return false; }
public static function get_timeline_ids4foreign_data($foreign_table, $foreign_id) { return \Util_Db::conv_col(\DB::select('id')->from('timeline')->where('foreign_table', $foreign_table)->where('foreign_id', $foreign_id)->execute()->as_array()); }