Perl: dbi_query_iterator with Iterator and understanding the $row

First let me explain that I’ve been up for more than 40 hours. I’ve had a few hours of sleep earlier today but my brain is not working yet.

On page 171, chapter 4, section 4.5.5 of Higher Order Perl by Mark Jason Dominus, the iterator example given shows an oddity that my brain is having trouble understanding. Specifically, it appears that the second row retrieved from the query result set is being thrown away. Is this correct?

} elsif ($action eq ‘nextval’) {
   my $oldrow = $row;
   $row = $sth->fetchrow_arrayref;
   return $oldrow->[0];
}

UPDATE: This simply sets up the next iteration. That way, we will know if the result set has been entirely processed and the next iteration will be the last iteration. Lesson learned: before reading Higher Order Perl, get some SLEEP!

Full subroutine code:

sub dbi_query_iterator {
    my ($sth, @params) = @_;
    $sth->execute(@params) or return;
    my $row = $sth->fetchrow_arrayref()
    return Iterator {
      my $action = shift() || ‘nextval’;
      if ($action eq ‘exhausted?’) {
        return ! defined $row;
      } elsif ($action eq ‘nextval’) {
        my $oldrow = $row;
        $row = $sth->fetchrow_arrayref;
        return $oldrow->[0];
      }
 }
Share Button

Progress made on the LD_POINTER_GUARD / ASE setup Issue!

Sybase’s setup causes some installs of ASE to fail

January 28th, 2007 jfroebe

ASE 12.5.4 setup (java version of Installshield) unsets LD_POINTER_GUARD, which will cause some linux distributions to fail to ’setup’ dataserver.

This appears to be a variation of the issue raised in the “Sybase’s Backup Server for Linux (64bit) is broken :(” post. What is unclear is whether this variable is being undefined by the Sybase supplied Java, Installshield itself or whether Sybase engineering is explicitly undefining it in the Installshield script. I’ve opened a case with Sybase to ensure that this gets resolved with the ASE 12.5.4 esd 6 ebf.

Sybase Techsupport has created CR455393 to address this issue. If you are running into this issue, please contact Sybase so we can get engineering attention for this.

Share Button

Out with Movable Type and in with WordPress

After waiting several months waiting for SixApart and Yahoo! to upgrade MovableType, I finally had enough of SixApart’s horrible customer service and migrated this blog to WordPress.

The migration was very easy 🙂

Share Button

How to start DBArtisan when you have Sybase Openclient 15 installed

It may not be commonly known, but Embarcadero’s DBArtisan (a database management tool) will NOT work with Openclient 15.  Did you know that there is a way for you to enjoy Openclient v15 and DBArtisan?  This will allow you to retain the system wide settings for v15 of Sybase Openclient:

  • You need to install v12.5 Openclient (or just copy the %SYBASE% directory from a machine with Openclient v12.5 installed). 
  • Create a text file called DBArtisan.cmd , replacing the paths and the name of the dbartisan executable as necessary:

 

@echo off
set SYBASE=C:\Sybase12.5
set SYBASE_OCS=OCS-12_5
set SYBASE_SYSAM=SYSAM-2_0
set SYBROOT=C:\Sybase12.5
set SYBASE_JS=JS-12_5
set SYBASE_JRE=C:\sybase12.5\Shared\Sun\jre142

start "C:\Program Files\Embarcadero\DBA813" DBArt813.exe
  • Create a short cut to the DBArtisan.cmd file with the right clicking on the file and choosing "Create Shortcut"
  • If you want the shortcut to use the same icon as DBArtisan:
  • right click on the file, choose "Properties"
  • "Change Icon"
  • Replace text with "%ProgramFiles%\Embarcadero\DBA813\DBArt813.exe" or wherever your DBArtisan executable is
  • Choose the icon and hit "OK"

 

Share Button

Partitioned tables and update statistics

Did you know that if you have a partitioned table, that running your normal update statistics or update index statistics does not update the statistics for the partitions?  Many dbas forget to perform update partition statistics on their partitions.  Sadly, neither Sybase or Rob Verschoor say much about it.  This is rather surprising as Rob is full of useful information about such things.

Of course, you could just run update all statistics but the overhead of maintaining the statistics is a nightmare and I have yet to find any real reason to do so.

Syntax (v12.x): 

update partition statistics table_name  [partition #]

Syntax (v15.x):

update table statistics table_name [partition name]
Share Button

Avoid using Movable Type hosted by Yahoo!

Way back on September 13th, 2006 I raised an issue with Six Apart, the company who makes Movable Type, and Yahoo!.  (The customer service people at Yahoo! told me to contact Six Apart as Six Apart wasn’t being responsive to Yahoo!’s techicians)  The issue is that the Movable Type software hosted by Yahoo! is quite old and about a third of the time, we receive the following messages that prevent us from working on our blogs:

Screen #1:

Time to Upgrade!

A new version of Movable Type has been installed. We’ll need to complete a few tasks to update your database.

Screen #2:

Your database is already current.

Screen #3:

Relogin (paraphrased)

On September 13th, I asked Six Apart for help.  September 30th, 2006 I received the following response from Six Apart:

According to Lisa on the MovableType Forums, Yahoo is in the process of upgrading the hosted MovableType to a more current version.

We’re in the process up updating the Yahoo customized version. I would strongly recommend sticking with 3.2 until Yahoo has the updated version available to you. Lisa

I have been trying to get a time frame from Six Apart as to when the Movable Type software on Yahoo! will be upgraded.  Complete silence from Six Apart.  I pay for using the Movable Type Software through Yahoo! but Six Apart seems not to care.

Please, if you are affected by this issue, let Six Apart know that you want this issue resolved (also here).

Share Button

FW: Top 10 Fashion Suggestions for (us) Nerds

While creating Fashion4Nerds.com, we interviewed over 30 young women between the ages of 18 and 32 about their likes and dislikes when it comes to guys’ fashion. We even asked them to give special attention to why they consider us Nerds unfashionable.

Here are their Top 10 responses, ordered by frequency of occurrence. Some tips may surprise you – they surprised us!
Read more….

I have always known that I’m the pinnacle of fashion 😉

Share Button

FW: Guide to fixing a laptop power jack

Fixing a DC power jack on your (or someone else’s) laptop can be difficult. Not knowing what you are up against is a sure sign that you won’t ever get it back together. However with the proper steps, repairing a DC Jack can be accomplished with little headache.  Read more….

I really wish this came out a year ago before I fried my laptop (it was old anyways) trying to repair it.  I’m better at soldering now.  Really.

Share Button

Has anyone seen these tables before?

They’re obviously for monitoring but I’m suspecting it is for some repository. When we ran across this database my immediate thought was that it was for Sybase’s Enterprise Application Server (EAServer / Jaguar)… second thought was for BMC Patrol but neither panned out. At this point I’m suspecting it was some customized monitoring software (homebrew) but I would like to know if they belong to some 3rd party monitoring application.

  • eas_version
  • eas_collection
  • eas_collection_object
  • eas_database
  • eas_filter
  • eas_map
  • eas_object
  • eas_object_type
  • eas_option
  • eas_option_type
  • eas_property
  • eas_schedule
  • eas_statistic
  • eas_collection_sql
  • eas_group
Any ideas?

UPDATE:

It ends up that these tables are part of a financial application from Sungard

Update #2:

It seems that I spoke too soon.  🙁 

Share Button

FW: Announcing the Sybase Adaptive Server Enterprise OLE DB Provider 15.0 for Windows 64-bit Beta program

Just letting everyone know that there is a new, albeit short, beta program from Sybase for their OLE DB Provider v15 for 64bit Windows 2003/XP (x86-64).  While, at this time, the beta officially doesn’t cover 64bit Windows Vista (x86-64), but Sybase Product Management is more than happy to listen to anyone that is willing to test the OLE DB Provider v15 on Vista 64bit.

While some Sybase beta programs in the past have required that the tester work at a company with a support contract, this beta does not.  It is open to anyone that wishes to test the provider.  At the end of the beta, if you wish to continue using the provider, you will need to obtain the Software Development Kit for Windows 64bit (x86-64) license.  Please make note of the x86-64 as you don’t want to receive the Itanium version.

The OLE DB Provider v15 beta program ends on March 28th, so don’t hesitate!

Continue reading “FW: Announcing the Sybase Adaptive Server Enterprise OLE DB Provider 15.0 for Windows 64-bit Beta program”

Share Button