大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。
Jetbrains全系列IDE稳定放心使用
#define int2 signed<2>
#define int4 signed<4>
#define int8 signed<8>
#define uint8 unsigned<8>
#define uint4 unsigned<4>
#define uint2 unsigned<2>
#define uint1 unsigned<1>
declare database testdb; //申明一个数据库定义名称
compact class Myclass //表名字
{
unsigned<4> id;
char<20> strnname;
string straddress;
unique tree<id> pkey; //索引
};
* at Fri Jul 31 09:44:42 2009
*/
#include “mcowrap.h”
/*———————————————————————*/
/* dictionary */
{
static mco_dictionary_t dict;
static int dictionary_ready = 0;
{
static mco_dict_field_t v_field_info[3] = {
/* Myclass */
{“id”, {4, 4, 0, 4, 4, 0}, 3, 8, 0, -1, 4, -1, 0, 0, -1, 0 /* 1 */},
{“straddress”, {2, 2, 4, 4, 4, 4}, 8, 0, 0, -1, 0, -1, 0, 2, -1, 0 /* 3 */},
{“strnname”, {20, 1, 6, 20, 1, 8}, 7, 0, 0, -1, 20, -1, 0, 1, -1, 0 /* 2 */}
};
{ “Myclass”, 1, 3, (v_field_info + 0), 26, 4, 28, 4 }
};
static const char * v_class_names[] =
{
0,
“Myclass” , /* [1] */
0
};
}
{
static const char * v_index_names[] =
{
“Myclass.pkey” , /* [0] */
0
};
}
static mco_dict_class_info_t class_inf[2] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, -1, -1, 0, 0, -1, 0, 0, -1, -2, 8, (v_struct_info + 0), 26, 0, -1, -1, -1 } /* Myclass */
};
dict.v_class_info = class_inf;
}
dict.v_desc_events = (mco_dict_event_t *)0;
{
static mco_dict_index_field_t v_all_index_fields[ 1] = {
{ 0, -1, 4, 3, 0, 1 } /* [0] id */
};
{ 1, 1, -1, 2051, & v_all_index_fields[0], 0 } /* Myclass.pkey [0] */
};
}
dict.version_minor = 1;
dict.version_build = 468;
dict.magic_number = 7;
dict.oid_is_supported = 0;
dict.auto_oid_supported = 0;
dict.flags = 0;
dict.n_class_codes = 1;
dict.n_list_indexes = 0;
dict.n_autoid_indexes = 0;
dict.n_history_indexes = 0;
dict.n_desc_indexes = 1;
dict.n_desc_events = 0;
dict.n_structs = 1;
dict.num_oid_estimation = 0;
dict.num_HA_estimation = 0;
dict.max_numof_indexes_per_obj = 1;
dict.exact_OID_sizeof = 0;
dict.layout_OID_size = 0;
}
}
{ return mco_w_new_obj_noid( t, 26, 1, (mco_objhandle_h)handle);
}
{ return mco_w_obj_delete( (mco_objhandle_h)handle);
}
{ return mco_w_obj_delete_all( t, 1 );
}
{ return mco_w_obj_checkpoint( (mco_objhandle_h)handle );
}
{ return mco_w_compact( (mco_objhandle_h)handle, 1, 0, pages_released);
}
{ return mco_w_b4_get( (mco_objhandle_h) handle, 0, result);
}
{ return mco_w_b4_put( (mco_objhandle_h) handle, 0, 1, *(uint4*)& value);
}
{ return mco_w_chars_get2( (mco_objhandle_h) handle, 8, 6, dest, dest_size, 20);
}
{ return mco_w_chars_put2( (mco_objhandle_h)handle, 8, 6, src, len, 20, 0);
}
{ return mco_w_string_get2( (mco_objhandle_h) handle, 4, 4, dest, dest_size, len);
}
{ return mco_w_string_len2( (mco_objhandle_h) handle, 4, 4, result);
}
{ return mco_w_string_put2( (mco_objhandle_h) handle, 4, 4, src, len, 0);
}
{ return mco_w_obj_from_cursor( t, c, 1, (mco_objhandle_h)handle );
}
{ return mco_w_index_cursor( t, 0, c );
}
{ mco_external_field_t a_ [1];
mco_external_field_h pa_ = a_;
pa_->field_type = 3; pa_->v.u4 = id;
}
{ mco_external_field_t a_[1];
mco_external_field_h pa_ = a_;
pa_->field_type = 3; pa_->v.u4 = id;
return mco_w_cursor_compare( t, c, a_, result_);
}
{ mco_external_field_t a_ [2];
mco_external_field_h pa_ = a_;
pa_->field_type = 3; pa_->v.u4 = id;
(pa_+1)->field_type=0;
*size_=mco_w_pattern_size(0, a_);
return MCO_S_OK;
}
{ mco_external_field_t a_ [2];
mco_external_field_h pa_ = a_;
pa_->field_type = 3; pa_->v.u4 = id;
(pa_+1)->field_type=0;
return mco_w_pattern_search(t, 0, allocated_pattern, memsize, (mco_objhandle_h )obj, a_);
}
{ return mco_w_pattern_next(t, 0 , allocated_pattern, (mco_objhandle_h) obj, 0);
}
{ return mco_w_cursor_locate( t, 0, (mco_objhandle_h)handle, c);
}
{ mco_external_field_t a_[1];
mco_external_field_h pa_ = a_;
pa_->field_type = 3; pa_->v.u4 = id;
return mco_w_tree_find_scalar(t, 0, a_, (mco_objhandle_h)handle_);
}
* at Fri Jul 31 09:44:42 2009
*/
#define __MCO__testdb__H__
#define MCO_CFG_WCHAR_SUPPORT
#include <wchar.h>
#endif
extern “C” {
#endif
#define MCO_COMP_VER_MINOR 1
#define MCO_COMP_BUILD_NUM 468
/* Handles and Class Codes */
#define Myclass_code 1
/* Dictionary */
/*———————————————————————*/
/* class Myclass methods */
MCO_RET Myclass_delete ( Myclass *handle );
MCO_RET Myclass_delete_all ( mco_trans_h t );
MCO_RET Myclass_checkpoint ( Myclass *handle );
MCO_RET Myclass_pack ( Myclass *handle, /*OUT*/ uint4 * pages_released );
MCO_RET Myclass_id_put ( Myclass *handle, uint4 value );
MCO_RET Myclass_strnname_put ( Myclass *handle, const char * src, uint2 len) ;
MCO_RET Myclass_straddress_size ( Myclass *handle, /*OUT*/ uint2 *result);
MCO_RET Myclass_straddress_put ( Myclass *handle, const char * src, uint2 len);
MCO_RET Myclass_pkey_search ( mco_trans_h t, /*INOUT*/ mco_cursor_h c, MCO_OPCODE op_, uint4 id );
MCO_RET Myclass_pkey_compare ( mco_trans_h t, mco_cursor_h c, uint4 id, /*OUT*/ int *result_ );
MCO_RET Myclass_pkey_pattern_size ( uint4 id, /*OUT*/ uint4 *size_);
MCO_RET Myclass_pkey_pattern_search ( mco_trans_h t, /*INOUT*/ void *allocated_pattern, uint4 memsize, /*OUT*/ Myclass *obj, uint4 id );
MCO_RET Myclass_pkey_pattern_next ( mco_trans_h t, /*INOUT*/ void *allocated_pattern, /*OUT*/ Myclass *obj);
MCO_RET Myclass_pkey_locate ( mco_trans_h t, /*OUT*/ mco_cursor_h c, Myclass * handle);
MCO_RET Myclass_pkey_find ( mco_trans_h t, uint4 id, /*OUT*/ Myclass *handle_);
} // extern “C”
#endif
4、然后用VC++6.0新建了一个工程Myproject,并把testdb.c,testdb.h拷到了该工程目录下,然后将testdb.c,testdb.h加入到该工程
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include “testdb.h”
const char *dbname=”demo ShmDb”;
const int SEGSZ=1024*1024*10;
const uint2 PAGESIZE=90;
const int MAP_ADDRESS=0x200000000;
void SH(void)
{
char test[]={“嵌入式实时数据库演示/n”};
char text1[]={“Copyright(c)2001-2005 Mcobject LLC.All Right Reserved./n”};
printf(“%s/n eXtremeDB runtime version %d.%d,build %d/n %s/n/n Press Enter to Start”,text,MCO_COMP_VER_MAJOR,MCO_COMP_VER_MINOR,MCO_COMP_BUILD_NUM,text1);
getchar();
}
static int askNumber(const char *prompt)
{
char buf[100];
printf(“/n%s”,prompt);
fgets(buf,sizeof(buf),stdin);
if(isdigit(buf[0]))
return atoi(buf);
return -1;
}
static char *askString(const char *prompt)
{
char buf[300];
static char buf1[300];
printf(“/n%s”,prompt);
}
Compiling…
Mytest.c
C:/123/Myproject/Mytest.c(9) : warning C4305: ‘initializing’ : truncation from ‘const __int64 ‘ to ‘const int ‘
C:/123/Myproject/Mytest.c(28) : warning C4101: ‘buf’ : unreferenced local variable
Linking…
LINK : warning LNK4098: defaultlib “MSVCRT” conflicts with use of other libs; use /NODEFAULTLIB:library
MSVCRTD.lib(crtexe.obj) : error LNK2001: unresolved external symbol _main
Debug/Myproject.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/181980.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...