Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

MakeTableQueryImpl.java 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. Copyright (c) 2008 Health Market Science, Inc.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package com.healthmarketscience.jackcess.impl.query;
  14. import java.util.List;
  15. import com.healthmarketscience.jackcess.query.MakeTableQuery;
  16. /**
  17. * Concrete Query subclass which represents an table creation query, e.g.:
  18. * {@code SELECT <query> INTO <newTable>}
  19. *
  20. * @author James Ahlborn
  21. */
  22. public class MakeTableQueryImpl extends BaseSelectQueryImpl
  23. implements MakeTableQuery
  24. {
  25. public MakeTableQueryImpl(String name, List<Row> rows, int objectId,
  26. int objectFlag) {
  27. super(name, rows, objectId, objectFlag, Type.MAKE_TABLE);
  28. }
  29. public String getTargetTable() {
  30. return getTypeRow().name1;
  31. }
  32. public String getRemoteDbPath() {
  33. return getTypeRow().name2;
  34. }
  35. public String getRemoteDbType() {
  36. return getTypeRow().expression;
  37. }
  38. @Override
  39. protected void toSelectInto(StringBuilder builder)
  40. {
  41. builder.append(" INTO ");
  42. toOptionalQuotedExpr(builder, getTargetTable(), true);
  43. toRemoteDb(builder, getRemoteDbPath(), getRemoteDbType());
  44. }
  45. @Override
  46. protected void toSQLString(StringBuilder builder)
  47. {
  48. toSQLSelectString(builder, true);
  49. }
  50. }