我有一个多行字符串,我在其中动态填充地图中的SQL查询。我收到一个MissingPropertyException,这是查询无法识别地图键或值的结果。有办法解决这个问题吗?
def multiString = """
def person = ['John': 'Builder']
person.each{ key, value ->
String query = """ UPDATE person SET value = '${value}'
WHERE name = '${key}' """ }
"""
答案 0 :(得分:0)
我明白了。我需要使用反斜杠来逃避$。
//Onvalue change
onValueChange(value: string) {
this.setState({
selected: value,
});
}
//This is render content
<TouchableOpacity style={ styles.row } onPress={ this.props.onPress }>
<Image style={ styles.image } source={{ uri: rowData.imageUri }} />
<View style={ styles.textsHolder }>
<Text ellipsizeMode='tail' numberOfLines={2} style={ [styles.name,stylesheet.mb4] }>{ rowData.name } </Text>
<View style={[{flexDirection: 'row'},stylesheet.mb4]}>
<Text style={ styles.prize }>$ { rowData.prize } </Text>
{
(rowData.regularPrize) ? <Text style={ styles.regularPrize }>$ { rowData.regularPrize }</Text>: null
}
</View>
<View style={{flexDirection: 'row',flex:1}}>
<View style={styles.pickerWraper}>
<Picker
mode="dropdown"
style={styles.picker}
selectedValue="200gm"
itemStyle={styles.pickerItem}
onValueChange={this.onValueChange.bind(this)}
>
<Item label="200gm" value="key0" />
<Item label="1kg" value="key1" />
</Picker>
</View>
<Button iconLeft small style={[stylesheet.pr5,stylesheet.ml5,styles.subbutton]}>
<Icon style={{marginRight:4, marginLeft:6,color:colors.white}} active name="cart" />
<Text style={{color:colors.txt_white}}>Subscribe</Text>
</Button>
</View>
</View>
</TouchableOpacity>