📄 numeric_usage.html
字号:
<html><head><meta name="KEYWORDS" content=" library, C++, Oracle, SQLServer, DB2, Sybase, Informix, InterBase, SQLBase, ODBC,
SQL, server, client, database, programming, development, software,
Win32, Windows, Linux, Unix, Solaris,
Microsoft, Borland, Centura, Gupta, IBM"><meta name="DESCRIPTION" content=
"SQLAPI++ is C++ library for accessing SQL databases (Oracle, SQLServer, Sybase, DB2, InterBase, SQLBase, Informix, ODBC).
It uses native APIs, provides low-level access to database-specific features."><title>SQLAPI++ Library - Online Documentation - SANumeric object</title></head><body bgcolor="#ffffff" BACKGROUND="../images/bg.gif" text="#000000"><!--GlbHdr--> <table WIDTH="600" height="40" frame="hsides" BORDER="2" BORDERCOLOR="#004fcd" align="right" cellpadding="0" cellspacing="2" id="TABLE1">
<tr><!--class="GlbDefault"-->
<td width="70" bgcolor="#000094" bordercolor="black" align="middle"><A href="../index.html" style="TEXT-DECORATION: none">
<font color="white" size="3" face="sans-serif">
<b>Home</b></font></A></td></TD>
<td width="70" bgcolor="#000094" bordercolor="black" align="middle"><A href="../HowTo/index.html" style="TEXT-DECORATION: none"> <font color="white" size="3" face="sans-serif">
<b>How To</b></font></A></td><!--class="GlbActive"-->
<td width="70" bgcolor="#00bb00" bordercolor="black" align="middle"><A href="index.html" style="TEXT-DECORATION: none"> <font color="white" size="3" face="sans-serif">
<b>Online Documentation</b></font></A></td><!--class="GlbDefault"-->
<td width="70" bgcolor="#000094" bordercolor="black" align="middle"><A href="../Support/index.html" style="TEXT-DECORATION: none"> <font color="white" size="3" face="sans-serif">
<b>Support</b></font></A></td>
<td width=70 bgcolor=#000094 bordercolor=black align=middle><A href="../Download/index.html" style="TEXT-DECORATION: none" >
<font color=white size=3
face=sans-serif>
<b>Download</b></font></A></td>
<td width="70" bgcolor="#000094" bordercolor="black" align="middle"><A href="../Order/index.html" style="TEXT-DECORATION: none"> <font color="white" size="3" face="sans-serif">
<b>Order</b></font></A></td> </tr>
</table>
<p> </p>
<table width="100%">
<tr>
<td valign="top" width="165"><!--LeftMenu-->
<table frame="void" CELLSPACING="5" width="165">
<tr><td><p> </p></td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12"><A href="Command.html" style="TEXT-DECORATION: none">
<font color="white" size="2" face="sans-serif">
SACommand</A> </FONT> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12"><A href="Connection.html" style="TEXT-DECORATION: none">
<font color="white" size="2" face="sans-serif">
SAConnection</A> </FONT> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12"><A href="Exception.html" style="TEXT-DECORATION: none">
<font color="white" size="2" face="sans-serif">
SAException</font></A> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12"><A href="Field.html" style="TEXT-DECORATION: none">
<font color="white" size="2" face="sans-serif">
SAField</A> </FONT> </td>
</tr>
<tr>
<td><img align="middle" src="../images/green.gif" WIDTH="12" HEIGHT="12"><A href="Param.html" style="TEXT-DECORATION: none">
<font color="white" size="2" face="sans-serif">
SAParam</A> </FONT> </td>
</tr>
<tr><td><hr></td></tr>
<tr>
<td><img align=middle src="../images/green.gif" WIDTH="12" HEIGHT="12">
<A href="String.html" style ="TEXT-DECORATION: none" >
<font color=white size=2 face=sans-serif>
SAString</A> </FONT> </td>
</tr>
<tr>
<td><img align=middle src="../images/green.gif" WIDTH="12" HEIGHT="12">
<A href="DateTime.html" style ="TEXT-DECORATION: none" >
<font color=white size=2 face=sans-serif>
SADateTime</A> </FONT> </td>
</tr>
<tr>
<td><img align=middle src="../images/red.gif" WIDTH="12" HEIGHT="12">
<A href="Numeric.html" style ="TEXT-DECORATION: none" >
<font color=white size=2 face=sans-serif>
SANumeric</A> </FONT> </td>
</tr>
<tr><td><hr></td></tr>
<tr>
<td>
<A href="Enums.html" style ="TEXT-DECORATION: none" >
<font color=white size=2 face=sans-serif>
Enums and Typedefs</A> </FONT> </td>
</tr>
</table>
</td><!--empty column-->
<td width="20">
<p> </p>
</td><!--Content-->
<td valign="top" align="left">
<table width="100%" cellspacing="2" cellpadding="2">
<tr>
<td align="left"><A href="Numeric.html" style="TEXT-DECORATION: none"><h3>Class Members</h3></A>
</td>
<td align="left"><A href="Numeric_Examples.html" style="TEXT-DECORATION: none"><h3>Examples</h3></A>
</td>
</tr>
<tr>
<td colspan="2"><h1>SANumeric object</h1></td>
</tr>
</table>
<p><STRONG>SANumeric</STRONG> is a subsidiary
class. The <STRONG>SANumeric</STRONG> class provides support for
manipulating exact numeric values with a fixed precission and scale.
The class supplies data members and operators for representind
numeric values without precision loss. It is useful when working
with such DBMS types as DECIMAL, NUMERIC, BIGINT, etc.</p>
<p>To create <STRONG>SANumeric</STRONG>value use one of the following <A
href="Numeric_cnstr.html">constructors</A>
:</p>
<UL>
<LI><STRONG>SANumeric( );</STRONG> - default constructor, creates
empty <STRONG>SANumeric</STRONG> value.
<LI><STRONG>SANumeric( double d );</STRONG> - copy constructor, used to create new
<STRONG>SANumeric</STRONG> value from <STRONG>double</STRONG>.
<LI><STRONG>SANumeric( const SAChar *s );</STRONG> - creates
<STRONG>SANumeric</STRONG> value from string.</LI></UL>
<p><A
href="Numeric_operator_double.html">operator
double</A> converts an existing <STRONG>SANumeric</STRONG>value to
double. <A
href="Numeric_operator_SAString.html">operator
SAString</A>
allows to
represent numeric value as a string without precision loss.</p>
<p>Data members <A
href="Numeric_precision.html">precission</A>,
<A
href="Numeric_scale.html">scale</A>
and <A
href="Numeric_sign.html">sign</A>
allows to set or get the precission (the maximum number of digits),
scale (the number of digits to the right of the decimal point) and
sign of <STRONG>SANumeric</STRONG>
object.</p>
<p>Data member <A
href="Numeric_val.html">val</A>
contains the numeric value as a 32-byte scaled integer.</p>
<p> For example, the base 10 number 123.4567 is
scaled to an integer 1234567, which is 12D687 in hexadecimal. The
value stored in the SA_NUMERIC_MANTISSA_SIZE-byte integer is 87 D6
12 00 00 00 00 00 00 00 00 00 00 00 00 ..... 00 00 00 <BR>(now
SA_NUMERIC_MANTISSA_SIZE is defined as 32). <BR>The
<EM>precision</EM> is 7, the <EM>scale</EM> is 4, and the
<EM>sign</EM>
is 1.</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 + -