~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item.cc

  • Committer: Olaf van der Spek
  • Date: 2011-06-05 21:25:02 UTC
  • mfrom: (2322 drizzle)
  • mto: (2318.2.9 rf)
  • mto: This revision was merged to the branch mainline in revision 2333.
  • Revision ID: olafvdspek@gmail.com-20110605212502-5c48zm4e9kdtyrys
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1353
1353
  return this;
1354
1354
}
1355
1355
 
1356
 
bool Item::send(plugin::Client *client, String *buffer)
 
1356
void Item::send(plugin::Client *client, String *buffer)
1357
1357
{
1358
 
  bool result= false;
1359
 
  enum_field_types f_type;
1360
 
 
1361
 
  switch ((f_type=field_type())) {
 
1358
  switch (field_type())
 
1359
  {
1362
1360
  case DRIZZLE_TYPE_DATE:
1363
1361
  case DRIZZLE_TYPE_NULL:
1364
1362
  case DRIZZLE_TYPE_ENUM:
1368
1366
  case DRIZZLE_TYPE_UUID:
1369
1367
  case DRIZZLE_TYPE_DECIMAL:
1370
1368
    {
1371
 
      String *res;
1372
 
      if ((res=val_str(buffer)))
1373
 
        result= client->store(res->ptr(),res->length());
 
1369
      if (String* res=val_str(buffer))
 
1370
        client->store(res->ptr(), res->length());
1374
1371
      break;
1375
1372
    }
1376
1373
  case DRIZZLE_TYPE_LONG:
1377
1374
    {
1378
 
      int64_t nr;
1379
 
      nr= val_int();
 
1375
      int64_t nr= val_int();
1380
1376
      if (!null_value)
1381
 
        result= client->store((int32_t)nr);
 
1377
        client->store((int32_t)nr);
1382
1378
      break;
1383
1379
    }
1384
1380
  case DRIZZLE_TYPE_LONGLONG:
1385
1381
    {
1386
 
      int64_t nr;
1387
 
      nr= val_int();
 
1382
      int64_t nr= val_int();
1388
1383
      if (!null_value)
1389
1384
      {
1390
1385
        if (unsigned_flag)
1391
 
          result= client->store((uint64_t)nr);
 
1386
          client->store((uint64_t)nr);
1392
1387
        else
1393
 
          result= client->store((int64_t)nr);
 
1388
          client->store((int64_t)nr);
1394
1389
      }
1395
1390
      break;
1396
1391
    }
1398
1393
    {
1399
1394
      double nr= val_real();
1400
1395
      if (!null_value)
1401
 
        result= client->store(nr, decimals, buffer);
 
1396
        client->store(nr, decimals, buffer);
1402
1397
      break;
1403
1398
    }
1404
1399
  case DRIZZLE_TYPE_TIME:
1406
1401
      type::Time tm;
1407
1402
      get_time(tm);
1408
1403
      if (not null_value)
1409
 
        result= client->store(&tm);
 
1404
        client->store(&tm);
1410
1405
      break;
1411
1406
    }
1412
1407
  case DRIZZLE_TYPE_DATETIME:
1416
1411
      type::Time tm;
1417
1412
      get_date(tm, TIME_FUZZY_DATE);
1418
1413
      if (!null_value)
1419
 
        result= client->store(&tm);
 
1414
        client->store(&tm);
1420
1415
      break;
1421
1416
    }
1422
1417
  }
1423
1418
  if (null_value)
1424
 
    result= client->store();
1425
 
 
1426
 
  return result;
 
1419
    client->store();
1427
1420
}
1428
1421
 
1429
1422
uint32_t Item::max_char_length() const