{"id":137,"date":"2007-01-24T20:10:39","date_gmt":"2007-01-24T11:10:39","guid":{"rendered":"http:\/\/www.climb.co.jp\/blog_dbmoto\/?p=137"},"modified":"2017-03-03T10:52:08","modified_gmt":"2017-03-03T01:52:08","slug":"%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0%e3%81%8a%e3%81%84%e3%81%a6%e3%81%ae%e3%83%ac%e3%82%b3%e3%83%bc%e3%83%89%e6%95%b0%e3%82%92%e7%a2%ba%e8%aa%8d%e3%81%ae%e6%96%b9%e6%b3%95%e3%80%90","status":"publish","type":"post","link":"https:\/\/www.climb.co.jp\/blog_dbmoto\/archives\/137","title":{"rendered":"\u30df\u30e9\u30fc\u30ea\u30f3\u30b0\u304a\u3044\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u6570\u3092\u78ba\u8a8d\u306e\u65b9\u6cd5\u3010\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30c4\u30fc\u30ebDBMoto\u3011"},"content":{"rendered":"<p>\u203b2015\u5e7411\u670826\u65e5\u306b\u30d0\u30fc\u30b8\u30e7\u30f38.5\u306b\u5408\u308f\u305b\u3066\u6539\u7a3f\u3002<br \/>\n<span style=\"color: #ff0000;\">\u203b\u30d0\u30fc\u30b8\u30e7\u30f39.0\u3067\u306f\u5f15\u6570\u304c\u8ffd\u52a0\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u30b5\u30f3\u30d7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5ba3\u8a00\u90e8\u5206\u3092\u305d\u308c\u305e\u308c\u4e0b\u8a18\u306b\u5909\u66f4\u3057\u3054\u5229\u7528\u304f\u3060\u3055\u3044\u3002<\/span><br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n<strong>\u25c7\u300cRecord_onAfterExecute\u300d<\/strong><br \/>\nPublic Overrides Sub Record_onAfterExecute(recTarget As IRecord, Failed As Boolean, e As Exception, ByRef AbortRecord As Boolean,ByRef DisableReplication As Boolean)<\/p>\n<p><strong>\u25c7\u300cRecord_onBeforeExecute\u300d<\/strong><br \/>\nPublic Overrides Sub Record_onBeforeExecute(recTarget As IRecord, ByRef AbortRecord As Boolean, ByRef DisableReplication As Boolean)<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>\u30df\u30e9\u30fc\u30ea\u30f3\u30b0\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u884c\u306a\u3046\u5834\u5408\u306f\u3001\u30bf\u30fc\u30b2\u30c3\u30c8\u30c6\u30fc\u30d6\u30eb\u306e\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u524d\u306e\u30ec\u30b3\u30fc\u30c9\u6570\u3001\u305d\u308c\u3068\u3082\u3001\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5f8c\u306e\u30ec\u30b3\u30fc\u30c9\u6570\u3092DBMoto\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u306b\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u30ec\u30b3\u30fc\u30c9\u6570\u3092DBMoto\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u306b\u51fa\u529b\u3059\u308b\u306b\u306f\u3001\u4e0b\u8a18\u306e\u65b9\u6cd5\u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>1) \u8a72\u5f53\u3059\u308b\u30df\u30e9\u30fc\u30ea\u30f3\u30b0\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u4e0d\u53ef\u306b\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>2) \u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u53f3\u30af\u30ea\u30c3\u30af\u3092\u3057\u3066\u3001\u300cReplication Properties\u300d\u3092\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<p>3) \u300cUse Script\u300d\u306e\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u3092\u30c1\u30a7\u30c3\u30af\u3092\u3057\u307e\u3059\u3002<\/p>\n<p>4) \u300cScript&#8230;\u300d\u30dc\u30bf\u30f3\u3092\u62bc\u4e0b\u3057\u3066\u3001\u300cReplication Script\u300d\u30a8\u30c7\u30a3\u30bf\u30fc\u3092\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<p>5)\u30a8\u30c7\u30a3\u30bf\u30fc\u306e\u5de6\u4e0b\u9685\u306e\uff13\u756a\u76ee\u306e\u30dc\u30bf\u30f3\u3092\u62bc\u4e0b\u3057\u3066\u3001\u300cReferences\u300d\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u8868\u793a\u3057\u307e\u3059\u3002<br \/>\n\u300cSystem.Data.dll\u300d\u3092\u5165\u529b\u3057\u3066\u3001\u300cOK\u300d\u30dc\u30bf\u30f3\u3092\u62bc\u4e0b\u3057\u307e\u3059\u3002<\/p>\n<p>6) \u300cReplication Script\u300d\u30a8\u30c7\u30a3\u30bf\u30fc\u306b\u4e0b\u8a18\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5165\u308c\u307e\u3059\u3002<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nImports Microsoft.VisualBasic<br \/>\nImports DBMotoPublic<br \/>\nImports DBMotoScript<br \/>\nImports DBRS.GlobalScript<br \/>\nImports System.Data<br \/>\nImports System<\/p>\n<p>Namespace DBRS<br \/>\nPublic Class ReplicationScript : Inherits IReplicationScript<\/p>\n<p>Dim conn as IDbConnection = Nothing<br \/>\nDim cmd as IDbCommand = Nothing<br \/>\nDim reader as IDataReader = Nothing<\/p>\n<p>&#8216;\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5b9f\u884c\u5f8c\u306e\u30e1\u30bd\u30c3\u30c9<br \/>\nPublic Overrides Sub Record_onAfterExecute(recTarget As IRecord, Failed As Boolean)<br \/>\nTry<br \/>\nconn = TargetConnection<br \/>\nSyncLock(conn)<br \/>\ncmd = conn.CreateCommand<br \/>\ncmd.CommandText = &#8220;select count(*) from TEST_TBL&#8221;<br \/>\nreader = cmd.ExecuteReader<br \/>\nDim iNumRecords = -1<\/p>\n<p>If reader.Read Then<br \/>\niNumRecords = reader.GetInt32(0)<br \/>\nEnd If<\/p>\n<p>AddLog(&#8220;AfterExecute- RecordCount: &#8221; &amp; iNumRecords.ToString, 0)<br \/>\nEnd SyncLock<br \/>\nCatch ex As Exception<br \/>\nAddLog(&#8220;Exception in AfterExecute: &#8221; &amp; ex.ToString,0)<br \/>\nFinally<br \/>\nif (not reader is Nothing) Then<br \/>\nreader.Close<br \/>\nEnd If<br \/>\nif (not cmd is Nothing) Then<br \/>\ncmd.Dispose<br \/>\nEnd If<br \/>\nEnd Try<\/p>\n<p>End Sub<\/p>\n<p>&#8216;\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5b9f\u884c\u524d\u306e\u30e1\u30bd\u30c3\u30c9<br \/>\nPublic Overrides Sub Record_onBeforeExecute(recTarget As IRecord, ByRef AbortRecord As Boolean)<br \/>\nTry<br \/>\nconn = TargetConnection<br \/>\nSyncLock(conn)<br \/>\ncmd = conn.CreateCommand<br \/>\ncmd.CommandText = &#8220;select count(*) from TEST_TBL&#8221;<br \/>\nreader = cmd.ExecuteReader<br \/>\nDim iNumRecords = -1<br \/>\nIf reader.Read Then<br \/>\niNumRecords = reader.GetInt32(0)<br \/>\nEnd If<br \/>\nAddLog(&#8220;BeforeExecute- RecordCount: &#8221; &amp; iNumRecords.ToString, 0)<br \/>\nEnd SyncLock<br \/>\nCatch ex As Exception<br \/>\nAddLog(&#8220;Exception in BeforeExecute: &#8221; &amp; ex.ToString,0)<br \/>\nFinally<br \/>\nif (not reader is Nothing) Then<br \/>\nreader.Close<br \/>\nEnd If<br \/>\nif (not cmd is Nothing) Then<br \/>\ncmd.Dispose<br \/>\nEnd If<br \/>\nEnd Try<br \/>\nEnd Sub<\/p>\n<p>End Class<br \/>\nEnd Namespace<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30df\u30e9\u30fc\u30ea\u30f3\u30b0\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u884c\u306a\u3046\u5834\u5408\u306f\u3001\u30bf\u30fc\u30b2\u30c3\u30c8\u30c6\u30fc\u30d6\u30eb\u306e\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u524d\u306e\u30ec\u30b3\u30fc\u30c9\u6570\u3001\u305d\u308c\u3068\u3082\u3001\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5f8c\u306e\u30ec\u30b3\u30fc\u30c9\u6570\u3092DBMoto\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u306b\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n <a href=\"https:\/\/www.climb.co.jp\/blog_dbmoto\/archives\/137\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-137","post","type-post","status-publish","format-standard","hentry","category-syniti"],"_links":{"self":[{"href":"https:\/\/www.climb.co.jp\/blog_dbmoto\/wp-json\/wp\/v2\/posts\/137","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.climb.co.jp\/blog_dbmoto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.climb.co.jp\/blog_dbmoto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.climb.co.jp\/blog_dbmoto\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.climb.co.jp\/blog_dbmoto\/wp-json\/wp\/v2\/comments?post=137"}],"version-history":[{"count":6,"href":"https:\/\/www.climb.co.jp\/blog_dbmoto\/wp-json\/wp\/v2\/posts\/137\/revisions"}],"predecessor-version":[{"id":2896,"href":"https:\/\/www.climb.co.jp\/blog_dbmoto\/wp-json\/wp\/v2\/posts\/137\/revisions\/2896"}],"wp:attachment":[{"href":"https:\/\/www.climb.co.jp\/blog_dbmoto\/wp-json\/wp\/v2\/media?parent=137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.climb.co.jp\/blog_dbmoto\/wp-json\/wp\/v2\/categories?post=137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.climb.co.jp\/blog_dbmoto\/wp-json\/wp\/v2\/tags?post=137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}