~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_read.cc

  • Committer: Jay Pipes
  • Date: 2009-01-30 04:01:12 UTC
  • mto: This revision was merged to the branch mainline in revision 830.
  • Revision ID: jpipes@serialcoder-20090130040112-svbn774guj98pwi4
To remain in compatibility with MySQL, added ability to interpret
decimal arguments as datetime strings for temporal functions.

Fixed YEAR(), MONTH(), DAYOFMONTH(), DAYOFYEAR(), HOUR(), MINUTE(), SECOND(), and MICROSECOND()
to accept decimal parameters and interpret them the same way as MySQL.

Fixed an issue with the TemporalFormat::matches() method which was 
incorrectly assuming all microsecond arguments were specified as 6 digits.
Added power of 10 multiplier to usecond calculation. This fixes issues with
failures in type_date and func_sapdb test cases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
15
 
 
16
 
#include "config.h"
17
 
 
18
 
#include "drizzled/internal/my_sys.h"
19
 
#include "drizzled/error.h"
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
 
 
16
#include "mysys_priv.h"
 
17
#include "mysys_err.h"
20
18
#include <errno.h>
21
19
 
22
 
namespace drizzled
23
 
{
24
 
namespace internal
25
 
{
26
 
 
27
20
 
28
21
/*
29
22
  Read a chunk of bytes from a file with retry's if needed
40
33
      N  number of bytes read.
41
34
*/
42
35
 
43
 
size_t my_read(int Filedes, unsigned char *Buffer, size_t Count, myf MyFlags)
 
36
size_t my_read(File Filedes, unsigned char *Buffer, size_t Count, myf MyFlags)
44
37
{
45
38
  size_t readbytes, save_count;
46
39
  save_count= Count;
50
43
    errno= 0;                                   /* Linux doesn't reset this */
51
44
    if ((readbytes= read(Filedes, Buffer, Count)) != Count)
52
45
    {
53
 
      errno= errno ? errno : -1;
 
46
      my_errno= errno ? errno : -1;
54
47
      if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR)
55
48
      {
56
49
        continue;                              /* Interrupted */
59
52
      {
60
53
        if (readbytes == (size_t) -1)
61
54
          my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
62
 
                   "unknown", errno);
 
55
                   my_filename(Filedes),my_errno);
63
56
        else if (MyFlags & (MY_NABP | MY_FNABP))
64
57
          my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
65
 
                   "unknown", errno);
 
58
                   my_filename(Filedes),my_errno);
66
59
      }
67
60
      if (readbytes == (size_t) -1 ||
68
61
          ((MyFlags & (MY_FNABP | MY_NABP)) && !(MyFlags & MY_FULL_IO)))
83
76
  }
84
77
  return(readbytes);
85
78
} /* my_read */
86
 
 
87
 
} /* namespace internal */
88
 
} /* namespace drizzled */