~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/date.cc

  • Committer: Brian Aker
  • Date: 2009-07-10 00:01:50 UTC
  • mto: (1090.1.1 staging)
  • mto: This revision was merged to the branch mainline in revision 1091.
  • Revision ID: brian@gaz-20090710000150-9ohs1x9ut0gt9skb
Fix protobuf to release memory. Add in assert() for wrong column usage. Fix
memory leak in temporal (from Jay)

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
   * automatic conversion from the higher-storage DateTime can be used
94
94
   * and matches on datetime format strings can occur.
95
95
   */
 
96
  ASSERT_COLUMN_MARKED_FOR_WRITE;
96
97
  drizzled::DateTime temporal;
97
98
  if (! temporal.from_string(from, (size_t) len))
98
99
  {
107
108
 
108
109
int Field_date::store(double from)
109
110
{
 
111
  ASSERT_COLUMN_MARKED_FOR_WRITE;
110
112
  if (from < 0.0 || from > 99991231235959.0)
111
113
  {
112
114
    /* Convert the double to a string using stringstream */
127
129
   * Try to create a DateTime from the supplied integer.  Throw an error
128
130
   * if unable to create a valid DateTime.  
129
131
   */
 
132
  ASSERT_COLUMN_MARKED_FOR_WRITE;
130
133
  drizzled::DateTime temporal;
131
134
  if (! temporal.from_int64_t(from))
132
135
  {
194
197
 
195
198
int64_t Field_date::val_int(void)
196
199
{
197
 
  uint32_t j= uint3korr(ptr);
 
200
  uint32_t j;
 
201
 
 
202
  ASSERT_COLUMN_MARKED_FOR_READ;
 
203
 
 
204
  j= uint3korr(ptr);
198
205
  j= (j % 32L)+(j / 32L % 16L)*100L + (j/(16L*32L))*10000L;
 
206
 
199
207
  return (int64_t) j;
200
208
}
201
209
 
208
216
  int part;
209
217
  char *pos=(char*) val_buffer->ptr()+10;
210
218
 
 
219
  ASSERT_COLUMN_MARKED_FOR_READ;
 
220
 
211
221
  /* Open coded to get more speed */
212
222
  *pos--=0;                                     // End NULL
213
223
  part=(int) (tmp & 31);