⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 command_operator_bind.html

📁 能够连接各种数据库的API
💻 HTML
📖 第 1 页 / 共 2 页
字号:
            &amp;</B></B></B></B></B>Value 
            <B> 
            <B> 
            <B> 
            <B><B>    
            );</B> 
            <B>  <BR>throw 
            (SAException);</B> 
            </B> 
            </B> 
            </B> 
            </B></FONT></FONT></FONT></FONT></FONT></P>

			<P><font face="Arial"><B>SACommand &amp;operator &lt;&lt; ( const SALongBinary 
            &amp;</B>LongValue<B>    
            );</B> 
            <B>  <BR>throw 
            (SAException);</B></font></P>

			<P><font face="Arial"><B>SACommand &amp;operator &lt;&lt; ( const SALongChar 
            &amp;</B>LongValue<B>    
            );</B> 
            <B>  <BR>throw 
            (SAException);</B></font></P><font face="Arial"><B>

			<P><font face="Arial"><B>SACommand &amp;operator &lt;&lt; ( const SABlob 
            &amp;</B>      
            </B>LobValue<B><B>    
            )</B><B>    
            ;</B> 
            <B>  <BR>throw 
            (SAException);</B></font></P>

			<P>SACommand &amp;operator &lt;&lt; ( const 
            SAClob &amp;</B>LobValue<B>    
            )</B><B>    
            ;</B> 
            <B>  <BR>throw 
            (SAException);</B></FONT></P><font face="Arial"><B>

			<P>SACommand &amp;operator &lt;&lt; ( const SAValueRead 
            &amp;</B>Value<B><B>    
            )</B><B>    
            ;</B> 
            <B>  <BR>throw 
            (SAException);</B>      
            </B></P></font>

			<P>       Binds input 
            variables. 
			</P>
            <H3>Parameters</H3>
            <p><EM>Value</EM> 
            .&nbsp;&nbsp;&nbsp; 
            A value of an input 
            variable.</p>
            <p><EM>LongValue</EM>.&nbsp;&nbsp;&nbsp; A reference to an aiding object 
            representing a value of a long input variable or a callback function which will be 
            used for getting the long 
            value.</p>
            <p><EM>LobValue</EM>.&nbsp;&nbsp;&nbsp; A reference to an aiding 
            object representing a value 
            of a Lob input variable or a callback function which will be 
            used for getting the Lob 
            value.</p>
            <p><EM>pos</EM>.&nbsp;&nbsp;&nbsp; A reference to the <STRONG>SAPos</STRONG> object which represents the position of 
            input parameter in the 
            command.</p>

			<h3>Remarks</h3>
            <P>This operator is used for associating data objects to the command object. Every 
            command object maintains an internal heterogeneous array of 
            parameter objects - this operator assigns values to parameter objects from this 
            array.&nbsp; </P>
            <P>Because of the operator returns a reference to a 
            <STRONG>SACommand</STRONG> object you can chain the operator e.g. 
            <EM>cmd &lt;&lt; 3 &lt;&lt; 2.5 &lt;&lt; 
            &quot;Istanbul&quot;;</EM></P>
      <P>By default the sequence of values 
      corresponds to the numbers of parameters in a command text.<BR><STRONG><EM>E.g. 
            </EM></STRONG>(cmd is a <STRONG>SACommnad</STRONG>  
         object)</P>
            <OL>
                <LI><FONT face="Times New Roman"><EM>Select a from b where c=         :1 and 
                      d=  :2<BR></EM><STRONG>cmd &lt;&lt; 5 
                &lt;&lt; &quot;qwerty&quot;; </STRONG><BR>binds <STRONG>5</STRONG> to 
                c(:1) and <STRONG>qwerty</STRONG>       to d(:2) 
                parameters. <BR>     
                     <BR></FONT>
                <LI><EM>Select a from b where c=   :2 and d=  
                       :1<BR></EM><STRONG>cmd &lt;&lt; 5 &lt;&lt; 
                &quot;qwerty&quot;; </STRONG><BR>binds <STRONG>5</STRONG> to 
                d(:1) and <STRONG>qwerty</STRONG>       to c(:2) 
                parameters (see the difference with example 1). <BR>       
                         <BR>
        <LI><EM>Select a from b where c=    :1 and  
                     d=  :3<BR></EM><STRONG>cmd &lt;&lt; 5 &lt;&lt; 
                &quot;qwerty&quot;; </STRONG><BR>     
         causes an error (throws an 
                exception) because <STRONG>&lt;&lt; 
                &quot;qwerty&quot;</STRONG>     
                  
                  tries to bind :2 parameter and our command 
                does not have such.</LI></OL>
            <P>If you want to assign <EM>null</EM> value to 
            an input variable you have to include <STRONG>SANull</STRONG> object 
            in the chain of bind operators in place of <EM>null</EM> value. </P>
            <P><STRONG><EM>E.g. 
            </EM></STRONG>(cmd is a <STRONG>SACommnad</STRONG> object) </P>
            <OL>
                <LI><FONT face="Times New Roman"><EM>Select a from b where c=         :1 and 
                      d=  :2<BR></EM><STRONG>cmd &lt;&lt; 5 
                &lt;&lt; SANull(); </STRONG><BR>binds <STRONG>5</STRONG> to 
                c(:1) and <STRONG>null</STRONG>       to d(:2) 
                parameters. <BR></FONT></LI></OL>
            <P>          
                    If you want to bind 
            a parameter by name or change the order of binding variables you 
            have to include a <STRONG>SAPos</STRONG> object before the value in the chain 
            of bind operators to prepare the required parameter position for the next 
            bind.</P>
            <P><EM><STRONG>E.g.</STRONG></EM> (cmd is a 
            <STRONG>SACommnad</STRONG>        
                        
            object)</P>
      <OL>
            <LI><EM>Select a from b where c = :1 and d 
                =          
                         :2 </EM>          
                               <BR><STRONG>cmd &lt;&lt; SAPos(2) &lt;&lt; 5 &lt;&lt; SAPos(1) 
                &lt;&lt; &quot;qwerty&quot;; </STRONG><BR>first binds d(:2) 
                parameter with value of <STRONG>5</STRONG>, then c(:1) with 
                value of <STRONG>qwerty</STRONG>.<BR>    
                        
                          &nbsp;
                       
                           
 
            <LI><EM>Select a from b where c = :c_bind 
                and d =          
                         :d_bind </EM> 
        <BR><STRONG>cmd &lt;&lt; SAPos(&quot;c_bind&quot;) &lt;&lt; 5 
                &lt;&lt; SAPos(&quot;d_bind&quot;) &lt;&lt; &quot;qwerty&quot;; 
                </STRONG><BR>  
                    
                   is the 
                right sequence to be used.</LI></OL>
			<P> 
                      
                       
              
                    
			</P>
            <P>Values for the input parameters can also be assigned to <STRONG 
            >SAParam</STRONG> 
 object. </P>
            <P>Syntax <STRONG>SACommand &amp;operator 
            &lt;&lt; ( const SAValueRead &amp;</B>Value );</STRONG> allows to 
            set input variable's value from existing <STRONG>SAParam</STRONG> or 
            <STRONG>SAField</STRONG> object.&nbsp; </P>
			
			<H3>Server specific notes</H3>
            <P>Binding Lob(CLob, BLob) data when working 
            with <STRONG><A 
            href="../ServerSpecific/Oracle.html" title="Oracle server specific information">Oracle</A></STRONG> 
            server has some 
            differences from others. It's necessary for a name of bind variable 
            to be the same as the column name it associated with.</P>
            <P><FONT face=System>Ex.:&nbsp;&nbsp;&nbsp;&nbsp; Update TEST set <FONT 
            color=maroon face="">FBLOB = :fblob</FONT> 
            where FKEY = 
               'KEY'</FONT> </P>
            <P>Therefore, it's impossible to bind Lob(CLob, 
            BLob) data to Oracle database by position. </P>
			
			<H3>See also</H3>
			<P>
			<A href="Command_CreateParam.html" target="" >CreateParam</A>, <A 
            href="Command_Param.html">Param</A>, <A 
            href="Command_ParamByIndex.html" 
            target="">ParamByIndex</A>, 
            <A 
            href="Command_ParamCount.html">ParamCount</A>   
			</P>
			<P><A href="Param.html" >SAParam</A>, <A 
            href="Field.html">SAField</A> 
			</P>
            <p><A href="../HowTo/errors.html" >Error 
            handling</A> </p>

			<H3>Problems and Questions</H3>
			<P>			If 
			you haven't found the answer to your questions or 
            have some problems on using the Library, please, send e-mail to <A 
            href="mailto:howto@sqlapi.com">howto@sqlapi.com</A>.
			</P>
		</td>
	<tr></tr>
</table>
</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -