亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? fastdb.htm

?? 用于嵌入式環境的數據庫
?? HTM
?? 第 1 頁 / 共 5 頁
字號:


<H3><A NAME = "function">Functions</A></H3>
<TABLE BORDER ALIGN="center">
<CAPTION>Predefined functions</CAPTION>
<TR><TH>Name</TH><TH>Argument type</TH><TH>Return type</TH><TH>Description</TH></TR>
<TR><TD>abs</TD><TD>integer</TD><TD>integer</TD><TD>absolute value of the argument</TD</TR>
<TR><TD>abs</TD><TD>real</TD><TD>real</TD><TD>absolute value of the argument</TD</TR>
<TR><TD>integer</TD><TD>real</TD><TD>integer</TD><TD>conversion of real to integer</TD</TR>
<TR><TD>length</TD><TD>array</TD><TD>integer</TD><TD>number of elements in array</TD</TR>
<TR><TD>lower</TD><TD>string</TD><TD>string</TD><TD>lowercase string</TD</TR><TR><TD>real</TD><TD>integer</TD><TD>real</TD><TD>conversion of integer to real</TD</TR>
<TR><TD>string</TD><TD>integer</TD><TD>string</TD><TD>conversion of integer to string</TD</TR>
<TR><TD>string</TD><TD>real</TD><TD>string</TD><TD>conversion of real to string</TD</TR>
<TR><TD>upper</TD><TD>string</TD><TD>string</TD><TD>uppercase string</TD</TR>
</TABLE><P>

FastDB allows user to define its own functions and operators.
Function should have at least one but no more than 3 parameters of string, integer, 
boolean, reference or user defined (raw binary) type. It should return value of integer, real, string or
boolean type.<P>
User functions should be registered by the <code>USER_FUNC(f)</code> macro, 
which creates a static object of the <code>dbUserFunction</code> class, binding 
the function pointer and the function name.<P>
There are two ways of implementing these functions in application.
First can be used only for functions with one argument. This argument should be of <code>int8, real8,
char*</code> types. And the function return type should be <code>int8, real8, char*</code> or <code>bool</code>.
If function has more than one parameters or it can accept parameters of different types (polymorphism)
then parameters should be passed as reference to <code>dbUserFunctionArgument</code> structure.
This structure contains <code>type</code> field, which value can be used in function implementation to
detect type of passed argument and union with argument value.
The following table contains mapping between argument types and where the value should be taken from:<P>

<TABLE BORDER ALIGN=CENTER>
<TR><TH>Argument type</TH><TH>Argument value</TH><TH>Argument value type</TH></TR>
<TR><TD><code>dbUserFunctionArgument::atInteger</code></TD><TD><code>u.intValue</code></TD><TD><code>int8</code></TD></TR>
<TR><TD><code>dbUserFunctionArgument::atBoolean</code></TD><TD><code>u.boolValue</code></TD><TD><code>bool</code></TD></TR>
<TR><TD><code>dbUserFunctionArgument::atString</code></TD><TD><code>u.strValue</code></TD><TD><code>char const*</code></TD></TR>
<TR><TD><code>dbUserFunctionArgument::atReal</code></TD><TD><code>u.realValue</code></TD><TD><code>real8</code></TD></TR>
<TR><TD><code>dbUserFunctionArgument::atReference</code></TD><TD><code>u.oidValue</code></TD><TD><code>oid_t</code></TD></TR>
<TR><TD><code>dbUserFunctionArgument::atRawBinary</code></TD><TD><code>u.rawValue</code></TD><TD><code>void*</code></TD></TR>
</TABLE><P>


For example the following
statements make it possible to use the <code>sin</code> function in SQL
statements:

<PRE>
        #include &lt;math.h&gt;
	...
        USER_FUNC(sin);
</PRE>


Functions can be used only
within the application, where they are defined. Functions are not accessible
from other applications and interactive SQL. If a function returns a string
type , the returned string should be copied by means of the operator
<code>new</code>, because
FastDB will call the destructor after copying the returned value.<P>

In FastDB, the function argument can (but not necessarily must) be enclosed in 
parentheses. So both of the following expressions are valid:

<PRE>
        '$' + string(abs(x))
	length string y
</PRE><P>

Functions with two argument can be also used as operators. Consider the following example, 
in which function <code>contains</code> which performs case insensitive search for substring is defined:

<PRE>
     bool contains(dbUserFunctionArgument& arg1, dbUserFunctionArgument& arg2) { 
         assert(arg1.type == dbUserFunctionArgument::atString 
	     && arg2.type == dbUserFunctionArgument::atString);
         return stristr(arg1.u.strValue, arg2.u.strValue) != NULL;
     }

     USER_FUNC(contains);
    
     dbQuery q1, q2;
     q1 = "select * from TestTable where name contains 'xyz'";
     q2 = "select * from TestTable where contains(name, 'xyz')";
</PRE>

In this example, queries <code>q1</code> and <code>q2</code> are equivalent.<P>



<H2><A NAME = "cpp">C++ interface</A></H2>
One of the primary goals of FastDB is to provide a flexible and convenient
application language interface. Anyone who has  to use 
ODBC or similar SQL interfaces will understand what I am speaking about.
In FastDB, a query can be written in C++ in the following way:<P>

<PRE>
    dbQuery q; 
    dbCursor&lt;Contract&gt; contracts;
    dbCursor&lt;Supplier&gt; suppliers;
    int price, quantity;
    q = "(price >=",price,"or quantity >=",quantity,
        ") and delivery.year=1999";
    // input price and quantity values
    if (contracts.select(q) != 0) { 
        do { 
            printf("%s\n", suppliers.at(contracts->supplier)->company);
        } while (contracts.next());
    } 
</PRE>

<H3><A NAME = "table">Table</A></H3>

Data in FastDB is stored in tables which correspond to C++ classes
whereas the table records correspond to class instances. 
The following C++ types are accepted as atomic components of
FastDB records:<P>

<TABLE BORDER ALIGN="center">
<TR><TH>Type</TH><TH>Description</TH></TR>
<TR><TD>bool</TD><TD>boolean type (<code>true,false</code>)</TD></TR>
<TR><TD>int1</TD><TD>one byte signed integer (-128..127)</TD></TR>
<TR><TD>int2</TD><TD>two bytes signed integer (-32768..32767)</TD></TR>
<TR><TD>int4</TD><TD>four bytes signed integer (-2147483648..2147483647)</TD></TR>
<TR><TD>int8</TD><TD>eight bytes signed integer (-2**63..2**63-1)</TD></TR>
<TR><TD>real4</TD><TD>four bytes ANSI floating point type</TD></TR>
<TR><TD>real8</TD><TD>eight bytes ANSI double precision floating point type</TD></TR>
<TR><TD>char const*</TD><TD>zero terminated string</TD></TR>
<TR><TD>dbReference&lt;T&gt;</TD><TD>reference to class T</TD></TR>
<TR><TD>dbArray&lt;T&gt;</TD><TD>dynamic array of elements of type T</TD></TR>
</TABLE><P>

In addition to types specified in the table above, FastDB records can
also contain nested structures of these components. 
FastDB doesn't support unsigned types to simplify the query language,
to  eliminate bugs caused by signed/unsigned comparison
and to reduce the size of the database engine.<P>

Unfortunately C++ provides no way
to get metainformation about a class at runtime (RTTI is not supported by all 
compilers and also doesn't provide enough information).
Therefore the programmer 
has to explicitly enumerate class fields to be included in the database table 
(it also makes mapping between classes and tables more flexible). 
FastDB provides a set of macros and classes to make such mapping as simple as 
possible.<P>

Each C++ class or structure, which will be used in the database, should 
contain a special method describing its fields. The macro 
<code>TYPE_DESCRIPTOR(</code><I>field_list</I><code>)</code> will construct 
this method. The single argument of this macro is - enclosed in parentheses -
a list of class field descriptors.
If you want to define some methods for the class
and make them available for the database, then the macro 
<code>CLASS_DESCRIPTOR(</code><I>name, field_list</I><code>)</code>
should be used instead of <code>TYPE_DESCRIPTOR</code>. The class name is
needed to get references to member functions.<P>

The following macros can be used for the construction of field
descriptors:

<DL>
<DT><B>FIELD(</B>name<B>)</B><DD>Non-indexed field with specified name.
<DT><B>KEY(</B>name, index_type<B>)</B><DD>Indexed field. <I>index_type</I> 
should be a combination of <code>HASHED</code> and <code>INDEXED</code> flags.
When the <code>HASHED</code> flag is specified, FastDB will create a hash table
for the table using this field as a key. When the <code>INDEXED</code> flag is 
specified, FastDB will create a (special kind of index) T-tree for the table 
using this field as a key. 
<DT><B>UDT(</B>name, index_type, comparator<B>)</B><DD>User defined raw binary type. 
Database deals with this type just as with sequence of bytes of specified size.
This field can be used in query (compared with query parameter of the same type), 
may be indexed and used in <code>order by</code> clause. Comparison is performed by means of
<code>comparator</code> function provided by programmer. Comparator functions receives three
arguments: two pointers to the compared raw binary objects and size of binary object.
The semantic of <I>index_type</I> is the same as of <code>KEY</code> macro.
<DT><B>RAWKEY(</B>name, index<B>)</B><DD>Raw binary type with predefined comparator.
This macro is just specialized version of <code>UDT</code> macro with <code>memcmp</code>
used as comparator.
<DT><B>RAWFIELD(</B>name<B>)</B><DD>One more specialization of <code>UDT</code> macro
for raw binary fields with predefined comparator <code>memcmp</code> and without indices.
<DT><B>SUPERCLASS(</B>name<B>)</B><DD>Specifies information about the base class
(parent) of the current class.
<DT><B>RELATION(</B>reference, inverse_reference<B>)</B>
<DD>Specifies <I>one-to-one, one-to-many</I> or <I>many-to-many</I>
relationships between classes (tables). Both <I>reference</I>
and <I>inverse_reference</I>
fields should be of reference or of array of reference type.
<code>inverse_reference</code> is a field of the referenced table
containing the inverse reference(s) to the current table. Inverse references
are automatically updated by FastDB and are used for query optimization
(see <A HREF="#inverse">Inverse references</A>).
<DT><B>OWNER(</B>reference, inverse_reference<B>)</B>
<DD>Specifies <I>one-to-many</I> or <I>many-to-many</I>
relationship between classes (tables) of owner-member type. 
When owner record is removed all referenced member records are also removed
(cascade delete). If member record has reference to owner class, it should be 
declared with RELATION macro.
<DT><B>METHOD(</B>name<B>)</B><DD>Specifies a method of the class.
The method should be a parameterless instance member function
returning a
boolean, numeric, reference or string type. Methods should be specified after 
all other attributes of the class. 
</DL><P>

Although only atomic fields can be indexed, an index type can be specified 
for structures. The index will be created for components of the structure
only if such type of index is specified in the index type mask of the 
structure. This allows the programmers to enable or disable indices for 
structure fields depending on the role of the structure in the record.<P>

The following example illustrates the creation of a type descriptor 
in the header file:<P>

<PRE>
class dbDateTime { 
    int4 stamp;
  public:
 
    int year() { 
	return localtime((time_t*)&stamp)-&gt;tm_year + 1900;
    }
    ...

    CLASS_DESCRIPTOR(dbDateTime, 
		     (KEY(stamp,INDEXED|HASHED), 
		      METHOD(year), METHOD(month), METHOD(day),
		      METHOD(dayOfYear), METHOD(dayOfWeek),
		      METHOD(hour), METHOD(minute), METHOD(second)));
};    

class Detail { 
  public:
    char const* name;
    char const* material;
    char const* color;
    real4       weight;

    dbArray&lt; dbReference&lt;Contract&gt; &gt; contracts;

    TYPE_DESCRIPTOR((KEY(name, INDEXED|HASHED), 
		     KEY(material, HASHED), 
		     KEY(color, HASHED),
		     KEY(weight, INDEXED),
		     RELATION(contracts, detail)));
};

class Contract { 
  public:
    dbDateTime            delivery;
    int4                  quantity;
    int8                  price;
    dbReference&lt;Detail&gt;   detail;
    dbReference&lt;Supplier&gt; supplier;

    TYPE_DESCRIPTOR((KEY(delivery, HASHED|INDEXED), 
		     KEY(quantity, INDEXED), 
		     KEY(price, INDEXED),
		     RELATION(detail, contracts),
		     RELATION(supplier, contracts)));
};
</PRE>

Type descriptors should be defined for all classes used in the database.
In addition to defining type descriptors, it is necessary to establish
a mapping between C++ classes and database tables. The macro 
<code>REGISTER(</code>name<code>)</code> will do it. Unlike the
<code>TYPE_DESCRIPTOR</code> macro, the <code>REGISTER</code> macro should
be used in the implementation file and not in the header file. It constructs
a descriptor of the table associated with the class. If you are going to work
with multiple databases from one application, it is possible to register
a table in a concrete database by means of the
<code>REGISTER_IN(</code>name,database</code<code>)</code> macro. 
The parameter <code>database</code> of this macro should be a pointer to the
<code>dbDatabase</code> object. You can register tables
in the database as follows:<P>

<PRE>
REGISTER(Detail);
REGISTER(Supplier);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩一二区| 日韩一区二区电影在线| 日本不卡1234视频| 国产精品私人自拍| 欧美一区二区三区公司| 成人福利视频在线看| 日韩二区三区在线观看| 亚洲精品中文字幕乱码三区| 久久久高清一区二区三区| 欧美亚洲国产一区在线观看网站| 国产高清精品网站| 久久国产麻豆精品| 视频一区视频二区中文| 日韩伦理av电影| 国产亚洲自拍一区| 精品国产一区久久| 欧美一区二区在线免费观看| 在线免费观看日本欧美| 成人av影视在线观看| 久草热8精品视频在线观看| 亚洲高清久久久| 亚洲欧洲中文日韩久久av乱码| 国产日韩av一区| 久久综合九色综合97_久久久| 一本大道综合伊人精品热热| 成人h动漫精品一区二| 国产精品香蕉一区二区三区| 久久精品99国产精品| 日韩影院免费视频| 日韩成人精品在线观看| 天天射综合影视| 天天av天天翘天天综合网| 亚洲影视资源网| 亚洲精品久久嫩草网站秘色| 综合电影一区二区三区| 中文字幕一区二区在线观看| 欧美国产亚洲另类动漫| 国产精品麻豆久久久| 国产欧美一区二区精品婷婷| 久久久蜜臀国产一区二区| 欧美精品一区二区三区视频 | 美腿丝袜在线亚洲一区| 日韩av网站免费在线| 日韩国产精品久久| 久久精品国产99| 黑人巨大精品欧美黑白配亚洲| 蜜臀av一区二区在线免费观看| 男人的天堂亚洲一区| 免费在线观看一区| 久久99国产乱子伦精品免费| 国产美女在线精品| 成人午夜激情在线| 91免费在线看| 欧美日韩黄色影视| 欧美大片一区二区| 中文字幕+乱码+中文字幕一区| 国产精品天美传媒沈樵| 亚洲精品国产高清久久伦理二区| 亚洲最新在线观看| 日韩在线一二三区| 激情文学综合丁香| www.视频一区| 精品1区2区3区| 欧美一级视频精品观看| 国产亚洲欧美在线| 亚洲视频一区在线| 日韩精品乱码av一区二区| 久久99精品国产91久久来源| 成人美女视频在线观看18| 日本韩国精品一区二区在线观看| 欧美日韩精品一区二区三区| 精品国产伦一区二区三区观看方式| 亚洲国产精品二十页| 亚洲国产另类av| 国内精品久久久久影院一蜜桃| 成人自拍视频在线观看| 欧美日韩你懂的| 国产日韩欧美亚洲| 亚洲123区在线观看| 国产精品一区在线观看你懂的| 91碰在线视频| 日韩限制级电影在线观看| 中文字幕在线播放不卡一区| 青青草成人在线观看| 成人午夜视频在线| 67194成人在线观看| 国产精品国产自产拍高清av王其 | 粉嫩一区二区三区性色av| 91亚洲国产成人精品一区二区三 | 亚洲福利国产精品| 国产超碰在线一区| 91精品国产综合久久小美女| 国产精品婷婷午夜在线观看| 日韩精品欧美成人高清一区二区| 懂色av一区二区三区蜜臀| 欧美精品日韩一本| 中文字幕欧美一| 国产精品一区二区三区乱码| 欧美日韩一区视频| 一区二区中文字幕在线| 国产一区二区三区在线观看精品 | 91久久精品国产91性色tv| 久久久久久久久久美女| 日韩在线一区二区| 在线观看一区日韩| 国产精品久久久久久久久搜平片 | 久久精品夜色噜噜亚洲a∨| 婷婷久久综合九色综合绿巨人| 91一区二区三区在线播放| 亚洲精品一区二区三区精华液 | 欧美一区在线视频| 一区二区三区91| 99久久精品国产一区二区三区| xnxx国产精品| 麻豆国产精品一区二区三区| 欧美日韩国产色站一区二区三区| 国产精品久久精品日日| 国产精品综合久久| 337p粉嫩大胆色噜噜噜噜亚洲| 日欧美一区二区| 欧美日本在线观看| 亚洲一区二区三区影院| 色综合中文字幕国产| 欧美国产一区二区| 国产成a人无v码亚洲福利| 久久精品人人做人人爽人人| 国内精品伊人久久久久影院对白| 欧美一区二区三区在线电影| 日韩精品一区第一页| 欧美一区二区三区免费在线看| 亚洲一区精品在线| 欧美丝袜丝交足nylons图片| 亚洲男人的天堂av| 欧美性生交片4| 视频一区在线播放| 欧美一级xxx| 久久99精品久久久久久国产越南 | 亚洲四区在线观看| 色婷婷国产精品| 一区二区三区四区亚洲| 一本到一区二区三区| 亚洲在线免费播放| 欧美乱妇一区二区三区不卡视频| 首页综合国产亚洲丝袜| 日韩视频在线观看一区二区| 狠狠色丁香婷综合久久| 国产亚洲午夜高清国产拍精品| 国产v综合v亚洲欧| 自拍av一区二区三区| 91福利在线导航| 日日摸夜夜添夜夜添亚洲女人| 日韩欧美区一区二| 国产成人亚洲综合a∨婷婷| 国产精品国产三级国产| 日本高清不卡在线观看| 日韩高清一区在线| 国产片一区二区| 在线影院国内精品| 免费成人在线视频观看| 久久精品亚洲麻豆av一区二区| 99精品视频一区| 日日夜夜精品免费视频| 国产日韩欧美a| 91国产丝袜在线播放| 久草热8精品视频在线观看| 中文字幕永久在线不卡| 欧美日韩在线播放一区| 国产美女视频一区| 一区二区三区四区不卡视频 | 亚洲人精品午夜| 欧美人与性动xxxx| 国产91精品露脸国语对白| 亚洲一区二三区| 精品国产麻豆免费人成网站| 91视频在线看| 蜜桃在线一区二区三区| 国产精品三级久久久久三级| 精品视频一区二区三区免费| 国产河南妇女毛片精品久久久| 亚洲午夜一区二区| 久久午夜国产精品| 欧美日韩成人激情| 丁香啪啪综合成人亚洲小说| 一区二区在线观看视频在线观看| 精品少妇一区二区三区在线视频| 91小视频在线| 国产一区二区三区精品欧美日韩一区二区三区 | 欧美高清视频不卡网| 国产很黄免费观看久久| 婷婷夜色潮精品综合在线| 国产精品看片你懂得| 精品区一区二区| 精品视频123区在线观看| 成人污视频在线观看| 免费高清视频精品| 一区二区三区四区五区视频在线观看 | 九一久久久久久| 舔着乳尖日韩一区| 亚洲精品v日韩精品| 久久久久99精品国产片|