{"id":47,"date":"2008-09-16T11:16:24","date_gmt":"2008-09-16T01:16:24","guid":{"rendered":"http:\/\/www.malcolmgroves.com\/blog\/?page_id=47"},"modified":"2008-09-16T22:01:01","modified_gmt":"2008-09-16T12:01:01","slug":"sqlsite","status":"publish","type":"page","link":"http:\/\/www.malcolmgroves.com\/blog\/?page_id=47","title":{"rendered":"SQLSite"},"content":{"rendered":"<p><span id=\"ucGenericFirstItemView_Label1\" class=\"LightNormalText\">CodeSite 2, from <a href=\"http:\/\/www.raize.com\/\">Raize Software <\/a>, is a powerful debugging tool for Borland Delphi and C++Builder. The problem? Often not all of the logic in your application is contained in Delphi or C++Builder code. Some logic is often contained in Stored Procedures and Triggers. However, by itself, CodeSite will only let you trace the flow of execution to the boundary of your Delphi or C++Builder code. What goes on inside your database is pretty much a mystery to CodeSite.<\/p>\n<p>Well, SQLSite tries to fix that. SQLSite is an extension to CodeSite 2, allowing CodeSite messages to be sent from within MS SQL Server Stored Procedures and Triggers. Now you can trace the flow of logic from your Delphi code to your Stored Procedure and back to your Delphi code, making it much easier to track down errors in your applications.<\/p>\n<h3 class=\"LightTitleText\">Requirements<\/h3>\n<p>SQLSite has been tested with CodeSite 2 Professional and SQL Server 7. I&#8217;m not taking advantage of any of the features not present in CodeSite 2 Standard, so I believe it should also work with the Standard Edition. Additionally, SQL Server has had Extended Stored Procedure support for a number of versions, so I believe it should also work with other versions of SQL Server. As I try it out with more versions, I&#8217;ll post the results.<\/p>\n<p><\/span><\/p>\n<h3><span id=\"ucGenericFirstItemView_Label1\" class=\"LightNormalText\"><\/p>\n<p class=\"LightTitleText\">Example<\/p>\n<p><\/span><\/h3>\n<p><span id=\"ucGenericFirstItemView_Label1\" class=\"LightNormalText\">As an example, the following test Stored Procedure:<\/p>\n<pre class=\"sourcecode\"><code class=\"keyword\">create<\/code> proc TestCS\r\n<code class=\"keyword\">AS<\/code>\r\n<code class=\"keyword\">declare<\/code> @callresult <code class=\"keyword\">integer\r\n<\/code>  <code class=\"keyword\">exec<\/code> csClear\r\n  <code class=\"keyword\">exec<\/code> csCategoryColor <code class=\"quote\">'clWhite'\r\n  <\/code><code class=\"keyword\">exec<\/code> csEnterMethod <code class=\"quote\">'TestCS'\r\n  <\/code><code class=\"keyword\">exec<\/code> csCategory <code class=\"quote\">'SQLSite Test'\r\n  <\/code><code class=\"keyword\">exec<\/code> csAddCheckPoint\r\n  <code class=\"keyword\">exec<\/code> csResetCheckpoint\r\n  <code class=\"keyword\">exec<\/code> csAddCheckPoint\r\n  <code class=\"keyword\">exec<\/code> csAddSeparator\r\n  <code class=\"keyword\">exec<\/code> csSendMemoryStatus\r\n  <code class=\"keyword\">exec<\/code> csSendMsg <code class=\"quote\">'Msg'\t\t\r\n<\/code>  <code class=\"keyword\">exec<\/code> csDisable\r\n  <code class=\"keyword\">exec<\/code> csSendMsg <code class=\"quote\">'Should not see this'\t\t\r\n<\/code>  <code class=\"keyword\">exec<\/code> csEnable\r\n  <code class=\"keyword\">exec<\/code> csCategoryColor <code class=\"quote\">'clYellow'\t\t\r\n<\/code>  <code class=\"keyword\">exec<\/code> @callresult = csEnabled\r\n  <code class=\"keyword\">if<\/code> (@callresult = 1)\r\n<code class=\"keyword\">    exec<\/code> csSendMsg <code class=\"quote\">'CodeSite Already Enabled'\t\t\r\n<\/code>  <code class=\"keyword\">else\t\t\r\n<\/code>  <code class=\"keyword\">begin\t\t\r\n<\/code>    <code class=\"keyword\">exec<\/code> csEnable    \r\n    <code class=\"keyword\">exec<\/code> csSendMsg <code class=\"quote\">'Just Enabled CodeSite'\r\n<\/code>  <code class=\"keyword\">end\t\t\r\n<\/code>  <code class=\"keyword\">exec<\/code> csSendMsg <code class=\"quote\">'Should see this'\t\t\r\n<\/code>  <code class=\"keyword\">exec<\/code> csSendString <code class=\"quote\">'String'<\/code>, <code class=\"quote\">'Value'\t\t\r\n<\/code>  <code class=\"keyword\">exec<\/code> csSendInteger <code class=\"quote\">'Integer'<\/code>, 1\r\n  <code class=\"keyword\">exec<\/code> csSendFloat <code class=\"quote\">'Float'<\/code>, 1.1\r\n  <code class=\"keyword\">exec<\/code> csSendNote <code class=\"quote\">'This is a test note'\t\t\r\n<\/code>  <code class=\"keyword\">exec<\/code> csWriteInteger <code class=\"quote\">'First'<\/code>, <code class=\"quote\">'Integer'<\/code>, 1\r\n  <code class=\"keyword\">exec<\/code> csWriteFloat <code class=\"quote\">'Second'<\/code>, <code class=\"quote\">'Float'<\/code>, 1.1\r\n  <code class=\"keyword\">exec<\/code> csWriteString <code class=\"quote\">'Third'<\/code>, <code class=\"quote\">'String'<\/code>, <code class=\"quote\">'Value'\t\t\r\n<\/code>  <code class=\"keyword\">exec<\/code> csWriteMsg <code class=\"quote\">'Fourth'<\/code>, <code class=\"quote\">'Msg'\t\t\r\n<\/code>  <code class=\"keyword\">exec<\/code> csExitMethod <code class=\"quote\">'TestCS'<\/code><\/pre>\n<p>produces the following output in the CodeSite 2 viewer:<\/p>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\n<tbody>\n<tr>\n<td class=\"PhotoSpacer\"><\/td>\n<td><a href=\"..\/..\/images\/sqlsitescreenshot.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"..\/..\/images\/sqlsitescreenshot_med.gif\" border=\"0\" alt=\"\" width=\"488\" height=\"224\" \/> <\/a><\/p>\n<p class=\"LightSmallText\">Click image for larger screenshot<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Currently, SQLSite supports the following CodeSite 2 calls, inside your SQL Server code. This seems to cover most requirements, but let me know if you simply can&#8217;t live without support for something else.<\/p>\n<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\n<tbody>\n<tr>\n<td width=\"50%\">\n<div class=\"LightTitleText\">CodeSite<\/div>\n<\/td>\n<td width=\"50%\">\n<div class=\"LightTitleText\">SQLSite Equivalent<\/div>\n<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.Category<\/td>\n<td width=\"50%\">csCategory<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.CategoryColor<\/td>\n<td width=\"50%\">csCategoryColor<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.AddSeparator<\/td>\n<td width=\"50%\">csAddSeparator<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.AddCheckpoint<\/td>\n<td width=\"50%\">csAddCheckpoint<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.ResetCheckpoint<\/td>\n<td width=\"50%\">csResetCheckpoint<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.SendMemoryStatus<\/td>\n<td width=\"50%\">csSendMemoryStatus<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.Clear<\/td>\n<td width=\"50%\">csClear<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.Enabled := True<\/td>\n<td width=\"50%\">csEnable<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.Enabled := False<\/td>\n<td width=\"50%\">csDisable<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.Enabled<\/td>\n<td width=\"50%\">csEnabled<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.DestinationDetails<\/td>\n<td width=\"50%\">csDestinationDetails<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.EnterMethod<\/td>\n<td width=\"50%\">csEnterMethod<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.ExitMethod<\/td>\n<td width=\"50%\">csExitMethod<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.SendMsg<\/td>\n<td width=\"50%\">csSendMsg<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.SendString<\/td>\n<td width=\"50%\">csSendString<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.SendInteger<\/td>\n<td width=\"50%\">csSendInteger<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.SendFloat<\/td>\n<td width=\"50%\">csSendFloat<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.SendNote<\/td>\n<td width=\"50%\">csSendNote<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.WriteInteger<\/td>\n<td width=\"50%\">csWriteInteger<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.WriteFloat<\/td>\n<td width=\"50%\">csWriteFloat<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.WriteString<\/td>\n<td width=\"50%\">csWriteString<\/td>\n<\/tr>\n<tr class=\"LightNormalText\">\n<td width=\"50%\">CodeSite.WriteMsg<\/td>\n<td width=\"50%\">csWriteMsg<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><\/span><\/p>\n<h3><span id=\"ucGenericFirstItemView_Label1\" class=\"LightNormalText\"><\/p>\n<p class=\"LightTitleText\">History<\/p>\n<p><\/span><\/h3>\n<p><span id=\"ucGenericFirstItemView_Label1\" class=\"LightNormalText\"><\/p>\n<p class=\"LightNormalText\">v1.0 &#8211; 28 August 2001<\/p>\n<ul>\n<li>\n<p class=\"LightNormalText\">Initial Public Release<\/p>\n<\/li>\n<\/ul>\n<p><\/span><\/p>\n<h3><span id=\"ucGenericFirstItemView_Label1\" class=\"LightNormalText\"><\/p>\n<p class=\"LightTitleText\">Download<\/p>\n<p><\/span><\/h3>\n<p><span id=\"ucGenericFirstItemView_Label1\" class=\"LightNormalText\"><\/p>\n<ul>\n<li>V1.0 <a href=\"..\/..\/projects\/sqlsite\/sqlsite.zip\">here<\/a><\/li>\n<\/ul>\n<p class=\"LightSmallText\">CodeSite is a trademark of <a href=\"http:\/\/www.raize.com\/\">Raize Software <\/a>.<br \/>\nSQL Server is a trademark of \t  <a href=\"http:\/\/www.microsoft.com\/\">Microsoft <\/a><\/p>\n<p><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>CodeSite 2, from Raize Software , is a powerful debugging tool for Borland Delphi and C++Builder. The problem? Often not all of the logic in your application is contained in Delphi or C++Builder code. Some logic is often contained in Stored Procedures and Triggers. However, by itself, CodeSite will only let you trace the flow [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":19,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-47","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/www.malcolmgroves.com\/blog\/index.php?rest_route=\/wp\/v2\/pages\/47","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.malcolmgroves.com\/blog\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.malcolmgroves.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.malcolmgroves.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.malcolmgroves.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=47"}],"version-history":[{"count":3,"href":"http:\/\/www.malcolmgroves.com\/blog\/index.php?rest_route=\/wp\/v2\/pages\/47\/revisions"}],"predecessor-version":[{"id":241,"href":"http:\/\/www.malcolmgroves.com\/blog\/index.php?rest_route=\/wp\/v2\/pages\/47\/revisions\/241"}],"up":[{"embeddable":true,"href":"http:\/\/www.malcolmgroves.com\/blog\/index.php?rest_route=\/wp\/v2\/pages\/19"}],"wp:attachment":[{"href":"http:\/\/www.malcolmgroves.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=47"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}