Examples of TDHSResponse


Examples of com.taobao.tdhs.client.response.TDHSResponse

  }

  @Test
  public void testClientIllegalStart() {
    try {
      TDHSResponse r = client.get(db, table, index,
          new String[] { "name" }, new String[][] { { "aaa" } },
          FindFlag.TDHS_EQ, -1, -1, null);
      Assert.assertEquals(0, r.getFieldData().size());
    } catch (Exception e) {
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

Examples of com.taobao.tdhs.client.response.TDHSResponse

    client.get(null);
  }

  @Test
  public void testClientFullGetZeroFilter() throws Exception {
    TDHSResponse r = client.get(db, table, index, new String[] { "name" },
        new String[][] { { "aaa" } }, FindFlag.TDHS_EQ, -1, -1,
        new Filter[0]);
    /* 2012-01-16 ClientStatus.NOT_FOUND -> ClientStatus.OK */
    Assert.assertEquals(ClientStatus.OK, r.getStatus());
  }
View Full Code Here

Examples of com.taobao.tdhs.client.response.TDHSResponse

  }

  @Test
  public void testClientFullGetNullFilter() throws Exception {
    Filter f = new Filter("aaaa", FilterFlag.TDHS_EQ, "cccc");
    TDHSResponse r = client.get(db, table, index, new String[] { "name" },
        new String[][] { { "aaa" } }, FindFlag.TDHS_EQ, 0, 100,
        new Filter[] { f });
    Assert.assertEquals(ClientStatus.NOT_FOUND, r.getStatus());
  }
View Full Code Here

Examples of com.taobao.tdhs.client.response.TDHSResponse

  @Test
  public void testClientSpecialChar() throws Exception {
    Filter f = new Filter("aaaa", FilterFlag.TDHS_EQ,
        "~!@#$%^&*()_+-={}[]:\\\";'<>?,./");
    TDHSResponse r = client.get("~!@#$%^&*()_+-={}[]:\\\";'<>?,./",
        "~!@#$%^&*()_+-={}[]:\\\";'<>?,./",
        "~!@#$%^&*()_+-={}[]:\\\";'<>?,./",
        new String[] { "~!@#$%^&*()_+-={}[]:\\\";'<>?,./" },
        new String[][] { { "~!@#$%^&*()_+-={}[]:\\\";'<>?,./" } },
        FindFlag.TDHS_EQ, 0, 100, new Filter[] { f });
    Assert.assertEquals(ClientStatus.NOT_FOUND, r.getStatus());
  }
View Full Code Here

Examples of com.taobao.tdhs.client.response.TDHSResponse

    } catch (Exception e) {
      Assert.assertEquals("field can't be empty!", e.getMessage());
    }

    try {
      TDHSResponse r = client.insert(db, table,
          new String[] { fields[2] }, new String[] { "0" });
      Assert.assertEquals(ClientStatus.OK, r.getStatus());
    } catch (Exception e) {
      Assert.assertEquals("field's size not match values's size",
          e.getMessage());
    } finally {
      client.delete(db, table, null, new String[][] { { "0" } },
View Full Code Here

Examples of com.taobao.tdhs.client.response.TDHSResponse

                throw new TDHSSQLException("error in alias[" + e.getKey() + "]", parseSQL.getSql());
            }
            alias[i++] = a;
        }
        if (field.length == 1 && field[0].equalsIgnoreCase("count(*)") && !columns.get(0).getValue().startsWith("`")) {
            TDHSResponse response = null;
            try {
                response = query.count();
            } catch (TDHSException e) {
                throw new SQLException(e);
            }
            processResponse(response, alias, false, false);

        } else {
            query.select(field);
            TDHSResponse response = null;
            try {
                response = query.get();
            } catch (TDHSException e) {
                throw new SQLException(e);
            }
View Full Code Here

Examples of com.taobao.tdhs.client.response.TDHSResponse

    }

    private void doDelete(com.taobao.tdhs.client.statement.Statement s, ParseSQL parseSQL, String tableName,
                          String dbName) throws SQLException {
        Query query = preprocessGet(s, parseSQL, tableName, dbName);
        TDHSResponse response = null;
        try {
            response = query.delete();
        } catch (TDHSException e) {
            throw new SQLException(e);
        }
View Full Code Here

Examples of com.taobao.tdhs.client.response.TDHSResponse

                        query.set().field(field).set(value);
                    }
                }
            }
        }
        TDHSResponse response = null;
        try {
            response = query.update();
        } catch (TDHSException e) {
            throw new SQLException(e);
        }
View Full Code Here

Examples of com.taobao.tdhs.client.response.TDHSResponse

                } else {
                    insert.value(field, value);
                }
            }
        }
        TDHSResponse response = null;
        try {
            response = insert.insert();
        } catch (TDHSException e) {
            throw new SQLException(e);
        }
View Full Code Here

Examples of com.taobao.tdhs.client.response.TDHSResponse

    @Test
    public void testTenThousand() throws TDHSException {
        TableInfo tableInfo = new TableInfo(db, table, null, fields);
        Get get = new Get(tableInfo, new String[][]{{"-1"}},
                TDHSCommon.FindFlag.TDHS_GE, 0, 10000);
        TDHSResponse r = client.count(get);
        Assert.assertEquals(TDHSResponseEnum.ClientStatus.OK, r.getStatus());
        Assert.assertEquals(1, r.getFieldData().size());
        Assert.assertEquals("10000", r.getFieldData().get(0).get(0));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.