views

Questions and answers regarding general SQL and backend databases

Postby jcompagner » Thu Mar 17, 2005 6:04 pm

could i see that solution? (with both version + and concat)

I do think that it also depends how much and how big the strings are that you put into one concat call..

html += "test"
or
html = html.concat("test")

then i think the + would be faster.
But the strange thing is that you are saying that with small record size the concat is faster..
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8892
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby patrick » Thu Mar 17, 2005 6:10 pm

But the strange thing is that you are saying that with small record size the concat is faster..


Since I nested the concat version into chunks of ca. 32 KB, this is not true anymore. Still interested to see that? (I have to send you the whole monster, which might be helpful for other issues, too...).
patrick
 
Posts: 3709
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Postby jcompagner » Thu Mar 17, 2005 6:47 pm

try this:

Code: Select all
var HTML = new java.lang.StringBuffer();

var maxReturnedRows = arguments[0]
var query = arguments[1]

var headerBgColor = '#cccccc'
var rowBgcolorLight = '#faf9f9'
var rowBgcolorDark = '#edeaea'

var dataset = databaseManager.getDataSetByQuery(currentcontroller.getServerName(), query, null, maxReturnedRows);

HTML.append('<html>').append('<HEAD>').append('<style type="text/css">').append('   .header{').append('      font-family: Verdana, Verdana, Arial, Helvetica, sans-serif;'
).append('      font-size: 9px;').append('      background-color: #999999;').append('      border: 12px solid #000000;').append('      color: #ffffff; text-decoration: none;}'
).append('   .body{').append('      font-family: Verdana, Verdana, Arial, Helvetica, sans-serif;').append('      font-size: 9px;').append('      color: #000000; text-decoration: none;}'
).append('   </style>').append('</HEAD>').append('<TABLE border=1 class="body">');

//create headers
HTML.append('<TR class="header"  >');
   for(var i=1 ; i <= dataset.getMaxColumnIndex() ; i++)
   {
       HTML.append('<TD border=0>').append(dataset.getColumnName(i)).append('</TD>');
   }
HTML.append('</TR>');

//create rows and columns
for( var i = 1 ; i <= dataset.getMaxRowIndex() ; i++ )
{
   dataset.rowIndex = i;
   
   //set rowBgColor
   if(i%2==0)
   {
      HTML.append('<TR bgcolor=').append(rowBgcolorLight).append('>');
   }
   else
   {
      HTML.append('<TR bgcolor=').append(rowBgcolorDark).append('>');
   }

      for(var j=1 ; j <=  dataset.getMaxColumnIndex() ; j++)
      {
         HTML.concat('<TD border=0>').append(dataset[j]).append('</TD>');
      }
   HTML.append('</TR>');
}
HTML.append('</TABLE>');
return HTML.toString();
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8892
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby jcompagner » Fri Apr 08, 2005 2:38 pm

in 2.2RC4 all special tricks/calls shouldn't be needed anymore.

just doe + where ever you want how much you want.
Also storing it in Xk blocks in a different variable shouldn't be done anymore just constantly append one value.

I am looking forward to know some results with the new javascript implementation. (and look if everything goes ok)
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8892
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Previous

Return to SQL Databases

Who is online

Users browsing this forum: No registered users and 4 guests