SQL查询 - >普通英语(SQL query -> normal english)
有人可以帮我把这个查询用于普通英语。 无需技术术语。 这是考试中的一个过去的纸质问题,它说“用英语解释以下代码片段的作用”谢谢。
CREATE TRIGGER SimpleTrigger AFTER UPDATE OF Quantity ON Stock FOR EACH ROW WHEN (:new.Quantity < 10) BEGIN INSERT INTO Reorder(StockCode, StockName, Quantity) VALUES (StockCode, StockName, 100); END;
Can someone please help me put this query in to normal English. No technical terms needed. This is a past paper question from an exam and it says "Explain in English what the following fragment of code does" Thanks.
CREATE TRIGGER SimpleTrigger AFTER UPDATE OF Quantity ON Stock FOR EACH ROW WHEN (:new.Quantity < 10) BEGIN INSERT INTO Reorder(StockCode, StockName, Quantity) VALUES (StockCode, StockName, 100); END;
原文:https://stackoverflow.com/questions/21104382
最满意答案
可选属性仅在Swift中可用,但对于可能
nil
值的Obj-C对象的类似想法应该很好。 您可以将以下NSNumber
属性添加到PhotoModel
:@property (nonatomic, strong) NSNumber *voted; @property (nonatomic, strong) NSNumber *purchased;
并在创建
PhotoModel
对象期间从解析的JSON分配BOOL值,如下所示:photoModelObject.voted = [NSNumber numberWithBool:[parsedJson valueForKey:@"voted"]]; photoModelObject.purchased = [NSNumber numberWithBool:[parsedJson valueForKey:@"purchased"]];
接下来,当您引用您的照片对象时,只需检查这些属性是否具有
nil
值。 如果它们是 - 你的用户没有登录,你不需要显示它们。 否则,像这样从它们中提取BOOL值:if (photoModelObject.voted && photoMobelObject.purchased) { BOOL isVoted = [photoModelObject.voted boolValue]; BOOL isPurchased = [photoModelObject.purchased boolValue]; // Use booleans to present info for registered users } else { // There is no info about votes and purchasing provided for the current user }
Optional properties are only available in Swift, but similar idea for the Obj-C — objects with possible
nil
value — should work well. You can add the followingNSNumber
properties to yourPhotoModel
:@property (nonatomic, strong) NSNumber *voted; @property (nonatomic, strong) NSNumber *purchased;
And assign your BOOL values from parsed JSON during
PhotoModel
object creation like this:photoModelObject.voted = [NSNumber numberWithBool:[parsedJson valueForKey:@"voted"]]; photoModelObject.purchased = [NSNumber numberWithBool:[parsedJson valueForKey:@"purchased"]];
Next, when you reference your photo object, just check if these properties have
nil
value. If they are — your user is not logged in and you don't need to show them. Otherwise, extract BOOL value from them like this:if (photoModelObject.voted && photoMobelObject.purchased) { BOOL isVoted = [photoModelObject.voted boolValue]; BOOL isPurchased = [photoModelObject.purchased boolValue]; // Use booleans to present info for registered users } else { // There is no info about votes and purchasing provided for the current user }
相关问答
更多-
只是不要将其映射指定为+ JSONKeyPathsByPropertyKey 。 Just don't specify its mapping to + JSONKeyPathsByPropertyKey.
-
我相信你只需要将闭包类型包围在括号中,就像这样: var respondToButton:((sender: UIButton) -> Bool)? 或者,如果这是一个封闭类型,您将经常使用,您可以创建一个typealias ,使其更易读: typealias buttonResponder = (sender: UIButton) -> Bool 那么在你的班上 var respondToButton:buttonResponder? I believe you just need to wrap ...
-
使用Mantle将NSString转换为带有MSON的JSON数组中的NSURL(Transform NSString to NSURL within a JSON Array with Mantle)[2021-08-24]
不幸的是,Mantle 1.x没有一种简单的方法将现有的变换器(在本例中,名为MTLURLValueTransformerName的变换器)应用于数组的每个元素。 你可以这样做: + (NSValueTransformer*)imagesJSONTransformer { NSValueTransformer *transformer = [NSValueTransformer valueTransformerForName:MTLURLValueTransformerName]; retu ... -
基于使用协议的想法,我创建了一个超类( gist here ): @interface ModelBase : RLMObject
然后正如@David Snabel-Caunt所说,我最终实现了MTLModel类的一些功能(来自MTLModel.m的复制粘贴)。 最后要使用它,你只需要子类化它。 Base on the idea of using the protocol, I created a super class (gist here) ... -
我的原始数据结构是XML(是的,我知道): ...
32.062883 34.782904 ... 我使用MTLXMLAdapter基于KissXML ,但你可以看到它如何适用于任何其他序列化程序。 + (NSValueTransformer *)coordinateXMLTransformer { return [MTLValueTransformer reversibleTransformerWithBlock:^id(NSArray ... -
正如你可能通过查看这个相关问题所知道的,Mantle已经将JSON中的int值0和1转换为Objective-C BOOL值。 我认为你的问题归结为一个简单的错字。 代替: @property (nonatomic, assign, readonly) BOOL *nsfw; 这是一个指针。 做: @property (nonatomic, assign, readonly) BOOL nsfw; 这是Mantle知道要翻译成的C类型。 As you probably know by looking a ...
-
可选属性仅在Swift中可用,但对于可能nil值的Obj-C对象的类似想法应该很好。 您可以将以下NSNumber属性添加到PhotoModel : @property (nonatomic, strong) NSNumber *voted; @property (nonatomic, strong) NSNumber *purchased; 并在创建PhotoModel对象期间从解析的JSON分配BOOL值,如下所示: photoModelObject.voted = [NSNumber numberW ...
-
如何挂入地幔(How to hook into Mantle)[2023-09-08]
尝试使用此代码段: - (id)initWithDictionary:(NSDictionary *)dictionary error:(NSError *__autoreleasing *)error { NSDictionary *hookedValue = [[NSDictionary alloc] initWithObjectsAndKeys: @"defaultValue1", @"defaultKey1", ... -
如何让YapDatabase和Mantle与序列化很好地配合(How to get YapDatabase and Mantle to play nicely with serialization)[2022-03-17]
您需要配置YapDatabase以使用Mantle。 默认情况下,它将使用NSCoding。 (这就是为什么你看到有关“encodeWithCoder:”的错误,因为该方法是NSCoding的一部分。) 看看YapDatabase的wiki文章“存储对象”,该文章讨论了它如何使用序列化器/解串器块: https : //github.com/yaptv/YapDatabase/wiki/Storing-Objects 基本上,当您分配/初始化YapDatabase实例时,您将需要传递使用Mantle执行序列 ... -
这里的问题是Mantle注入你的测试和你的主要目标。 这里的解决方案是相应地更改podfile: platform :ios, '7.0' target :app do pod 'Mantle', '~> 1.4' end target :appTests do pod 'Expecta', '~> 0.3' end 有关详细信息,请访问https://github.com/Mantle/Mantle/issues/217 。 祝好运! The problem here is th ...