特点: 简单,实用性超强,性能超好。
Ø 支持多种数据库 ( oracle , db2, sqlserver, postgres mysql , 达梦 , 南大(informix))。
Ø 提供表数据的同步缓存本地文件(大幅提高性能)。
Ø 0.5秒级的表数据更改同步(无漏.持久化), 0.5秒级的数据更改通知响应( 即时通知 ) 。
Ø 支持双网或多网络环境,支持桥接,支持正反向隔离环境(穿透)。
Ø 支持用户定制报文传输过程内容逐字加密 , 以及sql性能分析 ....
下载地址:
网盘: https://pan.baidu.com/s/1y29oErquZ-oCfUL232xo4Q 提取码 mazf
站内: https://download.youkuaiyun.com/download/hanxb/12188664
https://download.youkuaiyun.com/download/hanxb/12188959
这是通知机制的结构:
客户端编程:
读取:
DECLARE_XDB();
xbRecordset rec( pdb ) ;
xbVariant params[] = { 12, "abc" } ;
rec.Query( "select ID, name, blob_v from t_test where id = ? or name = ? " , params, 2 );
for( ; !rec.IsEOF() ; rec.MoveNext() ){
int32 id = rec.GetFieldValue_Int32( 0 ) ;
xbString name= rec.GetFieldValue_String(1);
const xbVariant & v = rec.GetFieldValue( 2 );
BYTE * blob_data = v.blob_data();
int32 blob_len = v.blob_length();
}
写入大字段:
DECLARE_XDB();
xbByteArray blobs[2] ;
pdb->Execute( "insert into t_test( ID, blob1, blob2) values( 12, ?, ? ) ", blobs, 2 ) ;
表数据同步到本地内存的例子:
void recv_record_func( XTableCache2Base * p, int event_type, XRecordset_idu * rs )
{
// 使用此接口可以自己管理表记录数据.(XTableCache2则内置了表记录内存管理,无需 自己维护)
// 这里测试代码只验证,不做数据集维护
std::cout << xbDateTime::GetNow().Format(3).c_str() ;
if( event_type == 1){ // 从本地文件缓存中装载 ( 运行开始后,先判断本地文件是否与数据库一致并装载)
std::cout << " first_load_all_from_localfile ( full-records ), rec_count = " << rs->GetRecordCount() << std::endl ;
}
else if( event_type == 2 ){ // 从数据库全装载
std::cout << " load/reload from database ( full-records ) , rec_count = " << rs->GetRecordCount() << std::endl ;
}
else if( event_type == 3 ){ // 数据库增量推送
int field_count = p->get_fieldinfo()->GetSize();
std::cout << " idu records from database, record_count = " << rs->GetRecordCount() << std::endl ;
while( !rs->IsEOF() ){
std::cout << " [" << rs->GetIDU() << "]: " ;
for( short idx = 0 ; idx < field_count; idx ++ ){
std::cout << p->get_fieldinfo()->GetAt(idx).m_szName << " = " << rs->GetFieldValue( idx ).OutAsString(0).c_str() << "," ;
if( rs->GetIDU() == 'D' ) break; // delete only can get primary_key
}
std::cout << "\n" ;
rs->MoveNext();
}
}
else if( event_type == -1 ){
std::cout << " net broken \n " ;
}
else if( event_type == -2 ){
std::cout << " net connect failed \n " ;
}
else if( event_type == 0 ){
std::cout << " net connected !! \n" ;
}
}
XTableCache2Base g_test_notify( "T_TEST1", "A,B,C", recv_record_func ) ;
// 基于 notify 的cache
void test_cache_notify()
{
std::cout << "\n\n\n========= test_notify_cache (push) , enter key to continue === \n";
getchar();
xbDbConnInfo dbConnInfo ;
dbConnInfo.LoadConfig();
g_test_notify.push_reg( dbConnInfo ) ; // 注册 启动一个表记录同步
}