<?xml version="1.0" encoding="utf-8"?>
			
			<rss version="2.0">
			<channel>
			<title>Trond Ulseth&apos;s Blog - SQL</title>
			<link>http://trond.ulseth.no/index.cfm</link>
			<description>Trond Ulseth</description>
			<language>en-us</language>
			<pubDate>Wed, 02 Jan 2008 13:02:01 -0600</pubDate>
			<lastBuildDate>Thu, 02 Aug 2007 08:35:00 -0600</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>trond@ulseth.no</managingEditor>
			<webMaster>trond@ulseth.no</webMaster>
			
			
			
			
			
			<item>
				<title>A couple of &quot;advanced&quot; ANT (in Eclipse) questions</title>
				<link>http://trond.ulseth.no/index.cfm/2007/8/2/A-couple-of-advanced-ANT-in-Eclipse-questions</link>
				<description>
				
				I started with ANT today. I see a huge potential in it. However I have now used the whole day trying to get two tings to work - and simply can&apos;t find the answer. I hope some ANT experts will take the time to answer the following questions:

1. Can I create a new Eclipse project with a ANT build? If so, how?

2. I get an error trying to create a database for my project with the following code:

&lt;code&gt;
&lt;target name=&quot;sql.runAll&quot; depends=&quot;sql.getLogin&quot;&gt;
&lt;sql driver=&quot;${sql.jdbcClasspath}&quot; url=&quot;${sql.jdbcURL}&quot; userid=&quot;uid&quot; password=&quot;pw&quot;&gt;
&lt;classpath&gt;
&lt;pathelement path=&quot;${sql.jdbcPath}&quot; /&gt;
&lt;/classpath&gt;		
CREATE DATABASE idlmedia02_${var.port}
&lt;/sql&gt;
&lt;/target&gt;
&lt;/code&gt;
The error: &lt;strong style=&quot;color:red;&quot;&gt;CREATE DATABASE statement not allowed within multi-statement transaction.&lt;/strong&gt;

Is there a way to use CREATE DATABASE statements from within ANT?

As always when I ask for help - I would be really thankful to anybody who can shed light on these subjects.
				
				</description>
				
				<category>SQL</category>
				
				<category>Eclipse</category>
				
				<pubDate>Thu, 02 Aug 2007 08:35:00 -0600</pubDate>
				<guid>http://trond.ulseth.no/index.cfm/2007/8/2/A-couple-of-advanced-ANT-in-Eclipse-questions</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>My take on CF/SQL pagination</title>
				<link>http://trond.ulseth.no/index.cfm/2006/4/26/My-take-on-CFSQL-pagination</link>
				<description>
				
				Raymond Camden has an entry on &lt;a href=&quot;http://ray.camdenfamily.com/index.cfm/2006/4/24/ColdFusion-and-Pagination&quot;&gt;ColdFusion and Pagination&lt;/a&gt; explaining how to do result set pagination with CF code.&lt;br/&gt;
&lt;br/&gt;
In a coment and &lt;a href=&quot;http://www.robgonda.com/blog/index.cfm/2006/4/25/MSSQL-and-Pagination&quot;&gt;following up with a post on his blog&lt;/a&gt; Rob Gonda sugests that for large recordsets the pagination should be done in the SQL rather than with CF code, utilizing stored procedures.&lt;br/&gt;
&lt;br/&gt;
So Ray&apos;s method is easy to use/understand and works with any DB, but is not suitable for large recordsets, and also the code is in the &amp;quot;view&amp;quot; part of your application. Rob&apos;s method is good when performance becomes a problem because of large recordsets, but is tied to the db, and requires knowledge of stored procedures.&lt;br/&gt;
&lt;br/&gt;
In all fairnes, I should get moving and learn the more advanced workabouts with SQL, but I&apos;ve not yet.&lt;br/&gt;
&lt;br/&gt;
So a while ago I was faced with the problem that I needed to deliver paged recordsets from a MSSQL db from a cfc to a Flash UI. So the method I&apos;ve used earlier (very similar to Ray&apos;s) was unsuitable. In MySQL it can easily be done with use of LIMIT and OFFSET, but it was a MSSQL db, and I did not have access (or knowledge) enough to do it with stored procedures (or other zillion lines long SQL examples I found online for solving this).&lt;br/&gt;
&lt;br/&gt;
I ended up with a fairly simple, yet very usable way of doing it. I&apos;m not sure how it would hold with very large recordsets, but in the given situation that was not an issue.&lt;br/&gt;
&lt;br/&gt;
Here&apos;s the (pseudo) code:&lt;br/&gt;
&lt;br/&gt;
&lt;code&gt;
&lt;cffunction access=&quot;remote&quot; name=&quot;getNews&quot;&gt; &lt;cfargument default=&quot;5&quot; type=&quot;numeric&quot; name=&quot;maxrows&quot;&gt; &lt;cfargument default=&quot;0&quot; type=&quot;numeric&quot; name=&quot;startrow&quot;&gt;

&lt;cfquery datasource=&quot;#application.dsn#&quot; name=&quot;getNews&quot;&gt; SELECT TOP #arguments.maxrows# *
FROM news
WHERE objectid NOT IN (
     SELECT TOP #arguments.startrow# objectid
     FROM news
     ORDER BY datetimecreated DESC
)
ORDER BY datetimecreated DESC
&lt;/cfquery&gt;

&lt;cfreturn getNews&gt;
&lt;/cffunction&gt;
&lt;/code&gt;
				
				</description>
				
				<category>SQL</category>
				
				<category>ColdFusion</category>
				
				<pubDate>Wed, 26 Apr 2006 09:14:00 -0600</pubDate>
				<guid>http://trond.ulseth.no/index.cfm/2006/4/26/My-take-on-CFSQL-pagination</guid>
				
				<enclosure url="http://trond.ulseth.no/enclosures/0" length="0" type=""/>
				
			</item>
			
		 	
			
			
			<item>
				<title>Good SQL advice from Mark Kruger</title>
				<link>http://trond.ulseth.no/index.cfm?mode=entry&amp;entry=340BDB16-EC4A-4DC4-0B6DB5F38BE50978</link>
				<description>
				
				&lt;p&gt;Mark got an &lt;a href=&quot;http://mkruger.cfwebtools.com/index.cfm/2005/10/27/like.wildcard&quot; target=&quot;_blank&quot;&gt;interesting article&lt;/a&gt; on using wildcards and square brackets in your queries where you use the LIKE expression. &lt;/p&gt;
				
				</description>
				
				<category>SQL</category>
				
				<pubDate>Thu, 27 Oct 2005 22:41:00 -0600</pubDate>
				<guid>http://trond.ulseth.no/index.cfm?mode=entry&amp;entry=340BDB16-EC4A-4DC4-0B6DB5F38BE50978</guid>
				
				<enclosure url="http://trond.ulseth.no/enclosures/0" length="0" type=""/>
				
			</item>
			
		 	
			
			
			<item>
				<title>Another SQL gotcha</title>
				<link>http://trond.ulseth.no/index.cfm?mode=entry&amp;entry=E923E84D-B512-36C2-3AF80E1A01A7B594</link>
				<description>
				
				&lt;p&gt;Yesterday I was working on the sample app for a &apos;soon to be announced&apos; new framework. I needed to query to get all records with a null value in a numerical field.&lt;/p&gt;
&lt;p&gt;Here&apos;s what I tried at first:&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;SELECT *&lt;br/&gt;
FROM forum_messages&lt;br/&gt;
WHERE msgParentID = NULL&lt;/div&gt;
&lt;p&gt;Problem was that it did not return any rows, but also did not throw any error. For a second I beleived that it must be something in the my application code that was wrong, but I threw the code into the SQL Query Analyzer and still got zero rows returned.&lt;/p&gt;
&lt;p&gt;Of course the answer was not further away than a quick Google search, and what I found was that I needed to change my SQL to this:&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;SELECT *&lt;br/&gt;
FROM forum_messages&lt;br/&gt;
WHERE msgParentID IS NULL&lt;/div&gt;
&lt;p&gt;If you are interested in the why of this you can read about it &lt;a href=&quot;http://www.windowsitpro.com/SQLServer/Article/ArticleID/7635/7635.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&lt;/p&gt;
				
				</description>
				
				<category>SQL</category>
				
				<pubDate>Thu, 13 Oct 2005 09:22:00 -0600</pubDate>
				<guid>http://trond.ulseth.no/index.cfm?mode=entry&amp;entry=E923E84D-B512-36C2-3AF80E1A01A7B594</guid>
				
				<enclosure url="http://trond.ulseth.no/enclosures/0" length="0" type=""/>
				
			</item>
			
		 	
			</channel></rss>
<SCRIPT language="Javascript">
<!--

// FILE ARCHIVED ON 20080102190211 AND RETRIEVED FROM THE
// INTERNET ARCHIVE ON 20100801045151.
// JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
// ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
// SECTION 108(a)(3)).

   var sWayBackCGI = "http://web.archive.org/web/20080102190211/";

   function xResolveUrl(url) {
      var image = new Image();
      image.src = url;
      return image.src;
   }
   function xLateUrl(aCollection, sProp) {
      var i = 0;
      for(i = 0; i < aCollection.length; i++) {
         var url = aCollection[i][sProp];         if (typeof(url) == "string") { 
          if (url.indexOf("mailto:") == -1 &&
             url.indexOf("javascript:") == -1
             && url.length > 0) {
            if(url.indexOf("http") != 0) {
                url = xResolveUrl(url);
            }
            url = url.replace('.wstub.archive.org','');
            aCollection[i][sProp] = sWayBackCGI + url;
         }
         }
      }
   }

   xLateUrl(document.getElementsByTagName("IMG"),"src");
   xLateUrl(document.getElementsByTagName("A"),"href");
   xLateUrl(document.getElementsByTagName("AREA"),"href");
   xLateUrl(document.getElementsByTagName("OBJECT"),"codebase");
   xLateUrl(document.getElementsByTagName("OBJECT"),"data");
   xLateUrl(document.getElementsByTagName("APPLET"),"codebase");
   xLateUrl(document.getElementsByTagName("APPLET"),"archive");
   xLateUrl(document.getElementsByTagName("EMBED"),"src");
   xLateUrl(document.getElementsByTagName("BODY"),"background");
   xLateUrl(document.getElementsByTagName("TD"),"background");
   xLateUrl(document.getElementsByTagName("INPUT"),"src");
   var forms = document.getElementsByTagName("FORM");
   if (forms) {
       var j = 0;
       for (j = 0; j < forms.length; j++) {
              f = forms[j];
              if (typeof(f.action)  == "string") {
                 if(typeof(f.method)  == "string") {
                     if(typeof(f.method) != "post") {
                        f.action = sWayBackCGI + f.action;
                     }
                  }
              }
        }
    }


//-->
</SCRIPT>

