let filePath = "uploaded image url"
var fileSize : UInt64
do {
let attr = try FileManager.default.attributesOfItem(atPath: (filePath?.path)!)
fileSize = attr[FileAttributeKey.size] as! UInt64
print(fileSize)
let fileSizeWithUnit = ByteCountFormatter.string(fromByteCount: Int64(fileSize), countStyle: .file)
print("File Size: \(fileSizeWithUnit)")
} catch {
print("Error: \(error)")
}
我们在用户身份验证后经常出现上述错误,并且用户需要超过1分钟的时间才能显示在在线表格中。关于原因和解决方案有什么想法吗?
谢谢
更新: 在使用的触发器下方:
public void calc(){
for(int i = 0; i < mSearchResultModelsToGetAppointments.size(); i++){
Location newLocation = new Location("");
newLocation.setLatitude(gpsTracker.getLatitude());
newLocation.setLongitude(gpsTracker.getLongitude());
if(String.valueOf(gpsTracker.getLatitude()).equalsIgnoreCase("0.0") || String.valueOf(gpsTracker.getLongitude()).equalsIgnoreCase("0.0")) {
} else{
Location oldLocation = new Location("");
oldLocation.setLatitude(mSearchResultModelUnderProcess.getLatitude());
oldLocation.setLongitude(mSearchResultModelUnderProcess.getLongitude());
float distanceInMeters = newLocation.distanceTo(oldLocation)/1000;
if(distanceInMeters < 2820){
getAdapter().notifyDataSetChanged();
getAdapter().removeItem(i);
getAdapter().notifyDataSetChanged();
}
}
}
}
UPDATE2:我们创建了2个触发器。一个在INSERT上,另一个在UPDATE上。
在radacct上插入后:
Error: [sql] Couldn't insert SQL accounting START record - Can't update table 'useraccounting' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
在radacct上更新后:
CREATE DEFINER=`mysql`@`%` TRIGGER `radacct_after_update` AFTER UPDATE ON `radacct` FOR EACH ROW BEGIN
if (NEW.acctoutputoctets != OLD.acctoutputoctets)
THEN
UPDATE useraccounting SET tmpQuta = tmpQuta + (New.acctoutputoctets - OLD.acctoutputoctets)
WHERE EXISTS (SELECT * FROM users WHERE users.userable_id = useraccounting.client_id AND users.userable_type = 'App\\Models\\Client' AND (users.username = New.username));
END IF;
END