Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion format difference for visual foxpro 9
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ethan Furman  
View profile  
 More options Oct 31 2012, 11:27 am
From: Ethan Furman <et...@stoneleaf.us>
Date: Wed, 31 Oct 2012 08:27:42 -0700
Local: Wed, Oct 31 2012 11:27 am
Subject: Re: [python-dBase] Re: format difference for visual foxpro 9

The Budiman wrote:
> Hello,

> Do you think it's right if we change in line 1871:

> if ord(null_data[byte]) >> bit & 1:

> to

> if ord(null_data[0]) >> bit & 1:

> Lets see the context:

>         nullable = flags & NULLABLE
>         binary = flags & BINARY
>         if nullable:
>             byte, bit = divmod(index, 8)
>             null_def = self._meta['_nullflags']
>             null_data = self._data[null_def[START]:null_def[END]]
>             try:
>                 if ord(null_data[0]) >> bit & 1:
>                     return Null
>             except IndexError:
>        print null_data
>                 print index
>                 print byte, bit
>                 print len(self._data), self._data
>                 print null_def
>                 print null_data
>                 raise

> As far as I can tell, the enclosing function (_retrieve_field_value)
> will return a field value. This part of code are checking if the field
> is nullable and if the field  value is in fact null. I'm guessing that
> null_def[START] and null_def[END] should contain the location of the
> null data or flag. In my cases, the length of the resulting null_data is
> always 1, so null_data[byte] usually throws the array out of range
> exception. I'm not sure what the 'byte' and 'bit' variable supposed to
> mean, but maybe in this case we just need to read that 1 character?

Each null byte stores the null state for up to eight fields; so if there are more than eight
nullable fields then null_data can be more than one byte long.  bit is which bit in the byte
represents the field in question.

So to make a long story short, no, changing to null_data[0] will not work once there are more than
eight nullable fields.

One possible problem, though, is that (I think) the varchar fields also use the null_data area to
keep track of varchar info, and I don't know how that interaction works.

~Ethan~


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.