542 if self.has_require_perfect_plan_: |
544 if self.has_require_perfect_plan_: |
543 self.has_require_perfect_plan_ = 0 |
545 self.has_require_perfect_plan_ = 0 |
544 self.require_perfect_plan_ = 0 |
546 self.require_perfect_plan_ = 0 |
545 |
547 |
546 def has_require_perfect_plan(self): return self.has_require_perfect_plan_ |
548 def has_require_perfect_plan(self): return self.has_require_perfect_plan_ |
|
549 |
|
550 def keys_only(self): return self.keys_only_ |
|
551 |
|
552 def set_keys_only(self, x): |
|
553 self.has_keys_only_ = 1 |
|
554 self.keys_only_ = x |
|
555 |
|
556 def clear_keys_only(self): |
|
557 if self.has_keys_only_: |
|
558 self.has_keys_only_ = 0 |
|
559 self.keys_only_ = 0 |
|
560 |
|
561 def has_keys_only(self): return self.has_keys_only_ |
547 |
562 |
548 |
563 |
549 def MergeFrom(self, x): |
564 def MergeFrom(self, x): |
550 assert x is not self |
565 assert x is not self |
551 if (x.has_app()): self.set_app(x.app()) |
566 if (x.has_app()): self.set_app(x.app()) |
557 if (x.has_hint()): self.set_hint(x.hint()) |
572 if (x.has_hint()): self.set_hint(x.hint()) |
558 if (x.has_offset()): self.set_offset(x.offset()) |
573 if (x.has_offset()): self.set_offset(x.offset()) |
559 if (x.has_limit()): self.set_limit(x.limit()) |
574 if (x.has_limit()): self.set_limit(x.limit()) |
560 for i in xrange(x.composite_index_size()): self.add_composite_index().CopyFrom(x.composite_index(i)) |
575 for i in xrange(x.composite_index_size()): self.add_composite_index().CopyFrom(x.composite_index(i)) |
561 if (x.has_require_perfect_plan()): self.set_require_perfect_plan(x.require_perfect_plan()) |
576 if (x.has_require_perfect_plan()): self.set_require_perfect_plan(x.require_perfect_plan()) |
|
577 if (x.has_keys_only()): self.set_keys_only(x.keys_only()) |
562 |
578 |
563 def Equals(self, x): |
579 def Equals(self, x): |
564 if x is self: return 1 |
580 if x is self: return 1 |
565 if self.has_app_ != x.has_app_: return 0 |
581 if self.has_app_ != x.has_app_: return 0 |
566 if self.has_app_ and self.app_ != x.app_: return 0 |
582 if self.has_app_ and self.app_ != x.app_: return 0 |
585 if len(self.composite_index_) != len(x.composite_index_): return 0 |
601 if len(self.composite_index_) != len(x.composite_index_): return 0 |
586 for e1, e2 in zip(self.composite_index_, x.composite_index_): |
602 for e1, e2 in zip(self.composite_index_, x.composite_index_): |
587 if e1 != e2: return 0 |
603 if e1 != e2: return 0 |
588 if self.has_require_perfect_plan_ != x.has_require_perfect_plan_: return 0 |
604 if self.has_require_perfect_plan_ != x.has_require_perfect_plan_: return 0 |
589 if self.has_require_perfect_plan_ and self.require_perfect_plan_ != x.require_perfect_plan_: return 0 |
605 if self.has_require_perfect_plan_ and self.require_perfect_plan_ != x.require_perfect_plan_: return 0 |
|
606 if self.has_keys_only_ != x.has_keys_only_: return 0 |
|
607 if self.has_keys_only_ and self.keys_only_ != x.keys_only_: return 0 |
590 return 1 |
608 return 1 |
591 |
609 |
592 def IsInitialized(self, debug_strs=None): |
610 def IsInitialized(self, debug_strs=None): |
593 initialized = 1 |
611 initialized = 1 |
594 if (not self.has_app_): |
612 if (not self.has_app_): |
618 if (self.has_offset_): n += 1 + self.lengthVarInt64(self.offset_) |
636 if (self.has_offset_): n += 1 + self.lengthVarInt64(self.offset_) |
619 if (self.has_limit_): n += 2 + self.lengthVarInt64(self.limit_) |
637 if (self.has_limit_): n += 2 + self.lengthVarInt64(self.limit_) |
620 n += 2 * len(self.composite_index_) |
638 n += 2 * len(self.composite_index_) |
621 for i in xrange(len(self.composite_index_)): n += self.lengthString(self.composite_index_[i].ByteSize()) |
639 for i in xrange(len(self.composite_index_)): n += self.lengthString(self.composite_index_[i].ByteSize()) |
622 if (self.has_require_perfect_plan_): n += 3 |
640 if (self.has_require_perfect_plan_): n += 3 |
|
641 if (self.has_keys_only_): n += 3 |
623 return n + 1 |
642 return n + 1 |
624 |
643 |
625 def Clear(self): |
644 def Clear(self): |
626 self.clear_app() |
645 self.clear_app() |
627 self.clear_kind() |
646 self.clear_kind() |
670 out.putVarInt32(self.composite_index_[i].ByteSize()) |
690 out.putVarInt32(self.composite_index_[i].ByteSize()) |
671 self.composite_index_[i].OutputUnchecked(out) |
691 self.composite_index_[i].OutputUnchecked(out) |
672 if (self.has_require_perfect_plan_): |
692 if (self.has_require_perfect_plan_): |
673 out.putVarInt32(160) |
693 out.putVarInt32(160) |
674 out.putBoolean(self.require_perfect_plan_) |
694 out.putBoolean(self.require_perfect_plan_) |
|
695 if (self.has_keys_only_): |
|
696 out.putVarInt32(168) |
|
697 out.putBoolean(self.keys_only_) |
675 |
698 |
676 def TryMerge(self, d): |
699 def TryMerge(self, d): |
677 while d.avail() > 0: |
700 while d.avail() > 0: |
678 tt = d.getVarInt32() |
701 tt = d.getVarInt32() |
679 if tt == 10: |
702 if tt == 10: |
835 ProtocolBuffer.Encoder.STRING, |
864 ProtocolBuffer.Encoder.STRING, |
836 |
865 |
837 ProtocolBuffer.Encoder.NUMERIC, |
866 ProtocolBuffer.Encoder.NUMERIC, |
838 |
867 |
839 ProtocolBuffer.Encoder.STRING, |
868 ProtocolBuffer.Encoder.STRING, |
|
869 |
|
870 ProtocolBuffer.Encoder.NUMERIC, |
840 |
871 |
841 ProtocolBuffer.Encoder.NUMERIC, |
872 ProtocolBuffer.Encoder.NUMERIC, |
842 |
873 |
843 ) |
874 ) |
844 |
875 |
2467 self.has_more_results_ = 0 |
2500 self.has_more_results_ = 0 |
2468 self.more_results_ = 0 |
2501 self.more_results_ = 0 |
2469 |
2502 |
2470 def has_more_results(self): return self.has_more_results_ |
2503 def has_more_results(self): return self.has_more_results_ |
2471 |
2504 |
|
2505 def keys_only(self): return self.keys_only_ |
|
2506 |
|
2507 def set_keys_only(self, x): |
|
2508 self.has_keys_only_ = 1 |
|
2509 self.keys_only_ = x |
|
2510 |
|
2511 def clear_keys_only(self): |
|
2512 if self.has_keys_only_: |
|
2513 self.has_keys_only_ = 0 |
|
2514 self.keys_only_ = 0 |
|
2515 |
|
2516 def has_keys_only(self): return self.has_keys_only_ |
|
2517 |
2472 |
2518 |
2473 def MergeFrom(self, x): |
2519 def MergeFrom(self, x): |
2474 assert x is not self |
2520 assert x is not self |
2475 if (x.has_cursor()): self.mutable_cursor().MergeFrom(x.cursor()) |
2521 if (x.has_cursor()): self.mutable_cursor().MergeFrom(x.cursor()) |
2476 for i in xrange(x.result_size()): self.add_result().CopyFrom(x.result(i)) |
2522 for i in xrange(x.result_size()): self.add_result().CopyFrom(x.result(i)) |
2477 if (x.has_more_results()): self.set_more_results(x.more_results()) |
2523 if (x.has_more_results()): self.set_more_results(x.more_results()) |
|
2524 if (x.has_keys_only()): self.set_keys_only(x.keys_only()) |
2478 |
2525 |
2479 def Equals(self, x): |
2526 def Equals(self, x): |
2480 if x is self: return 1 |
2527 if x is self: return 1 |
2481 if self.has_cursor_ != x.has_cursor_: return 0 |
2528 if self.has_cursor_ != x.has_cursor_: return 0 |
2482 if self.has_cursor_ and self.cursor_ != x.cursor_: return 0 |
2529 if self.has_cursor_ and self.cursor_ != x.cursor_: return 0 |
2483 if len(self.result_) != len(x.result_): return 0 |
2530 if len(self.result_) != len(x.result_): return 0 |
2484 for e1, e2 in zip(self.result_, x.result_): |
2531 for e1, e2 in zip(self.result_, x.result_): |
2485 if e1 != e2: return 0 |
2532 if e1 != e2: return 0 |
2486 if self.has_more_results_ != x.has_more_results_: return 0 |
2533 if self.has_more_results_ != x.has_more_results_: return 0 |
2487 if self.has_more_results_ and self.more_results_ != x.more_results_: return 0 |
2534 if self.has_more_results_ and self.more_results_ != x.more_results_: return 0 |
|
2535 if self.has_keys_only_ != x.has_keys_only_: return 0 |
|
2536 if self.has_keys_only_ and self.keys_only_ != x.keys_only_: return 0 |
2488 return 1 |
2537 return 1 |
2489 |
2538 |
2490 def IsInitialized(self, debug_strs=None): |
2539 def IsInitialized(self, debug_strs=None): |
2491 initialized = 1 |
2540 initialized = 1 |
2492 if (self.has_cursor_ and not self.cursor_.IsInitialized(debug_strs)): initialized = 0 |
2541 if (self.has_cursor_ and not self.cursor_.IsInitialized(debug_strs)): initialized = 0 |
2501 def ByteSize(self): |
2550 def ByteSize(self): |
2502 n = 0 |
2551 n = 0 |
2503 if (self.has_cursor_): n += 1 + self.lengthString(self.cursor_.ByteSize()) |
2552 if (self.has_cursor_): n += 1 + self.lengthString(self.cursor_.ByteSize()) |
2504 n += 1 * len(self.result_) |
2553 n += 1 * len(self.result_) |
2505 for i in xrange(len(self.result_)): n += self.lengthString(self.result_[i].ByteSize()) |
2554 for i in xrange(len(self.result_)): n += self.lengthString(self.result_[i].ByteSize()) |
|
2555 if (self.has_keys_only_): n += 2 |
2506 return n + 2 |
2556 return n + 2 |
2507 |
2557 |
2508 def Clear(self): |
2558 def Clear(self): |
2509 self.clear_cursor() |
2559 self.clear_cursor() |
2510 self.clear_result() |
2560 self.clear_result() |
2511 self.clear_more_results() |
2561 self.clear_more_results() |
|
2562 self.clear_keys_only() |
2512 |
2563 |
2513 def OutputUnchecked(self, out): |
2564 def OutputUnchecked(self, out): |
2514 if (self.has_cursor_): |
2565 if (self.has_cursor_): |
2515 out.putVarInt32(10) |
2566 out.putVarInt32(10) |
2516 out.putVarInt32(self.cursor_.ByteSize()) |
2567 out.putVarInt32(self.cursor_.ByteSize()) |
2519 out.putVarInt32(18) |
2570 out.putVarInt32(18) |
2520 out.putVarInt32(self.result_[i].ByteSize()) |
2571 out.putVarInt32(self.result_[i].ByteSize()) |
2521 self.result_[i].OutputUnchecked(out) |
2572 self.result_[i].OutputUnchecked(out) |
2522 out.putVarInt32(24) |
2573 out.putVarInt32(24) |
2523 out.putBoolean(self.more_results_) |
2574 out.putBoolean(self.more_results_) |
|
2575 if (self.has_keys_only_): |
|
2576 out.putVarInt32(32) |
|
2577 out.putBoolean(self.keys_only_) |
2524 |
2578 |
2525 def TryMerge(self, d): |
2579 def TryMerge(self, d): |
2526 while d.avail() > 0: |
2580 while d.avail() > 0: |
2527 tt = d.getVarInt32() |
2581 tt = d.getVarInt32() |
2528 if tt == 10: |
2582 if tt == 10: |
2557 res+=prefix+("result%s <\n" % elm) |
2614 res+=prefix+("result%s <\n" % elm) |
2558 res+=e.__str__(prefix + " ", printElemNumber) |
2615 res+=e.__str__(prefix + " ", printElemNumber) |
2559 res+=prefix+">\n" |
2616 res+=prefix+">\n" |
2560 cnt+=1 |
2617 cnt+=1 |
2561 if self.has_more_results_: res+=prefix+("more_results: %s\n" % self.DebugFormatBool(self.more_results_)) |
2618 if self.has_more_results_: res+=prefix+("more_results: %s\n" % self.DebugFormatBool(self.more_results_)) |
|
2619 if self.has_keys_only_: res+=prefix+("keys_only: %s\n" % self.DebugFormatBool(self.keys_only_)) |
2562 return res |
2620 return res |
2563 |
2621 |
2564 kcursor = 1 |
2622 kcursor = 1 |
2565 kresult = 2 |
2623 kresult = 2 |
2566 kmore_results = 3 |
2624 kmore_results = 3 |
|
2625 kkeys_only = 4 |
2567 |
2626 |
2568 _TEXT = ( |
2627 _TEXT = ( |
2569 "ErrorCode", |
2628 "ErrorCode", |
2570 "cursor", |
2629 "cursor", |
2571 "result", |
2630 "result", |
2572 "more_results", |
2631 "more_results", |
|
2632 "keys_only", |
2573 ) |
2633 ) |
2574 |
2634 |
2575 _TYPES = ( |
2635 _TYPES = ( |
2576 ProtocolBuffer.Encoder.NUMERIC, |
2636 ProtocolBuffer.Encoder.NUMERIC, |
2577 ProtocolBuffer.Encoder.STRING, |
2637 ProtocolBuffer.Encoder.STRING, |
2578 |
2638 |
2579 ProtocolBuffer.Encoder.STRING, |
2639 ProtocolBuffer.Encoder.STRING, |
|
2640 |
|
2641 ProtocolBuffer.Encoder.NUMERIC, |
2580 |
2642 |
2581 ProtocolBuffer.Encoder.NUMERIC, |
2643 ProtocolBuffer.Encoder.NUMERIC, |
2582 |
2644 |
2583 ) |
2645 ) |
2584 |
2646 |