hi all !
I need some help please
I'm using a database tool for developing and driving dynamic content.
With the tool I use I make queries based on my tables and I set the sorting order of my mysql tables.
Unfortunately the sorting tool does not function.
Is there any way or 3th party script that will enforce my mysql tables to sort on the tablels and columns of my choice?
This is what I could find in the database tool files that seem to be connected to the sorting;
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Query script:
MYSQL Script:
thanks already to any genius around
michael
PS this pieces of script are snippets of the full script, but as far as I could see only this was / is related to the sort function
I need some help please
I'm using a database tool for developing and driving dynamic content.
With the tool I use I make queries based on my tables and I set the sorting order of my mysql tables.
Unfortunately the sorting tool does not function.
Is there any way or 3th party script that will enforce my mysql tables to sort on the tablels and columns of my choice?
This is what I could find in the database tool files that seem to be connected to the sorting;
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Query script:
Code:
# Sort rows If (scalar (@sortby) > 0 and $fileset{DBTYPE} NE 'SQL' or $randomorder) { # SQL databases use their own internal sort, but not necessarily a random one If ($randomorder) { # Random selection overrides all other sorts # Random order Undef my @tempreturns; $count = 0; Until ($count > $finalrecord or scalar (@returns) == 0) { $record = int (rand(scalar (@returns))); Push (@tempreturns, splice (@returns, $record, 1)); $count ++; } @returns = @tempreturns; } Elsif ($finalrecord - $firstrecord + 1 >= 0.6 * scalar (@returns)) { # Inbuilt sort function is faster if the number of rows to return is greater # than about 60% of the total number of rows @returns = sort { sortby ($a, $b) } @returns; } Else { # Otherwise, the custom ChopSort is faster &ChopSort (\@returns, \@sortby); } }
Code:
# Read in query header Open (QUERYHEAD, "files/$file/queries/$query.qh") or quitit ("Could not open query header file [datacgi/files/$file/queries/$query.qh].", 1); @qh = <QUERYHEAD>; Close QUERYHEAD; For (0..1) { shift @qh; } Chomp (@qh); @sortby = split (/\Q[|]\E/, shift @qh); # Save sorting information for later Undef %groupby; %groupby = split (/,| /, pop (@sortby)) if (scalar (@sortby) % 2); # For backward compatibility, assume '[|]group, by, details' may not exist at end of file line $rawcriteria = shift @qh; # Save criteria string for later $statsnotneeded = shift @qh; # Save advanced options for later $randomorder = 0; # True if random order required # Add sorting information My $sortcomm = ''; LOOP: for ($count = 0; $count < scalar (@sortby); $count ++) { If ($count % 2) { If ($sortby[$count] eq 'random') { $randomorder = 1; Last LOOP; # Skip out of loop, as other ordering is pointless } Else { $sortcomm .= ' DESC' if ($sortby[$count] =~ /DEC$/); } } Else { $sortcomm .= ', ' if ($count); # Don't add comma to start of first field (ie: $count == 0) $sortcomm .= qq|"$sortby[$count]"|; } } $sqlcomm .= qq| ORDER BY $sortcomm| if (!$randomorder and length ($sortcomm) > 0);
michael
PS this pieces of script are snippets of the full script, but as far as I could see only this was / is related to the sort function
Comment