是否可以通过命令行在mysql查询中使用shell变量? 我想做的是:
$ var='test'
$ mysql -e 'INSERT INTO table (text) VALUE ($var);' database
即使我使用${var}
我知道怎么做这样的事情吗?
我必须留在shell中,因为我通过 jenkins'执行shell'
运行答案 0 :(得分:0)
所以,在评论的帮助下,我终于设法做到了。
链接explanations of quotes in mysql解释了所有内容。
解决方案:
####<15 juil. 2015 09 h 52 CEST> <Notice> <Security> <MyUsername> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1436946746252> <BEA-090082> <Security initializing using security realm myrealm.>
####<15 juil. 2015 09 h 52 CEST> <Notice> <WebLogicServer> <MyUsername> <AdminServer> <[STANDBY] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1436946771648> <BEA-000365> <Server state changed to STANDBY.>
####<15 juil. 2015 09 h 52 CEST> <Notice> <WebLogicServer> <MyUsername> <AdminServer> <[STANDBY] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1436946771650> <BEA-000365> <Server state changed to STARTING.>
####<15 juil. 2015 09 h 53 CEST> <Warning> <EJB> <MyUsername> <AdminServer> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1436946795598> <BEA-012035> <The Remote interface method: public abstract boolean com.myclasses.UtilityRemote.send(com.mytypes.ReqType,java.lang.String) in EJB UtilityBean contains a parameter of type com.mytypes.ReqType which is not serializable. Though the EJB IMMJMSUtilityBean has call-by-reference set to false, this parameter is not serializable and hence will be passed by reference. A parameter can be passed using call-by-value only if the parameter type is serializable.>
####<15 juil. 2015 09 h 53 CEST> <Notice> <Log Management> <MyUsername> <AdminServer> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1436946808540> <BEA-170027> <The server has successfully established a connection with the Domain level Diagnostic Service.>
####<15 juil. 2015 09 h 53 CEST> <Notice> <WebLogicServer> <MyUsername> <AdminServer> <[STANDBY] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1436946809347> <BEA-000365> <Server state changed to ADMIN.>
####<15 juil. 2015 09 h 53 CEST> <Notice> <WebLogicServer> <MyUsername> <AdminServer> <[STANDBY] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1436946809503> <BEA-000365> <Server state changed to RESUMING.>
####<15 juil. 2015 09 h 53 CEST> <Notice> <Server> <MyUsername> <AdminServer> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1436946809774> <BEA-002613> <Channel "Default[1]" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.>
####<15 juil. 2015 09 h 53 CEST> <Warning> <Server> <MyUsername> <AdminServer> <DynamicListenThread[Default]> <<WLS Kernel>> <> <> <1436946809774> <BEA-002611> <The hostname "MyUsername.MyProxy.com", maps to multiple IP addresses: 172.23.247.5, 0:0:0:0:0:0:0:1.>
####<15 juil. 2015 09 h 53 CEST> <Notice> <Server> <MyUsername> <AdminServer> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1436946809775> <BEA-002613> <Channel "Default[2]" is now listening on 0:0:0:0:0:0:0:1:7001 for protocols iiop, t3, ldap, snmp, http.>
####<15 juil. 2015 09 h 53 CEST> <Notice> <Server> <MyUsername> <AdminServer> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1436946809775> <BEA-002613> <Channel "Default" is now listening on 172.23.247.5:7001 for protocols iiop, t3, ldap, snmp, http.>
####<15 juil. 2015 09 h 53 CEST> <Notice> <WebLogicServer> <MyUsername> <AdminServer> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1436946809776> <BEA-000331> <Started the WebLogic Server Administration Server "AdminServer" for domain "test" running in development mode.>
####<15 juil. 2015 09 h 53 CEST> <Notice> <WebLogicServer> <MyUsername> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1436946810276> <BEA-000360> <The server started in RUNNING mode.>
####<15 juil. 2015 09 h 53 CEST> <Notice> <WebLogicServer> <MyUsername> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1436946810280> <BEA-000365> <Server state changed to RUNNING.>