Replicates table structure and data from source to temporary table.

@param tableName  existing table name
@param toCopyData boolean

@return new table name

@throws SQLException for any issue
341106
public String replicateTable(String tableName, boolean toCopyData) throws SQLException {
        String tempTableName = MySqlCommunication.getTempTableName(tableName);
        LOG.debug("Replicate table {} into {}", tableName, tempTableName);
        if (this.tableExists(tempTableName)) {
            this.truncateTempTable(tempTableName);
        } else {
            this.createTempTable(tableName);
        }
        if (toCopyData) {
            final String sql = "INSERT INTO " + tempTableName + " SELECT * FROM " + tableName + ";";
            this.executeUpdate(sql);
        }
        return tempTableName;
    }
991750
private <A> TableData<A> tableData(final ResultSet rs,
                                       final RowFunction<A> f)
        throws SQLException {

        final ResultSetMetaData meta = rs.getMetaData();
        final int c = meta.getColumnCount();
        final TableData<A> td = new TableData<A>();

        for (int p = 1; p <= c; p++) {
            final String n = meta.getColumnLabel(p);
            td.columns.add((n == null || "".equals(n)) ? "col" + p : n);
        } // end of for

        // First row
        td.rows.add(f.apply(rs));

        // Other row(s)
        while (rs.next()) {
            td.rows.add(f.apply(rs));
        } // end of if

        return td;
    }
792507
List<CmsAliasTableRow> copyData(List<CmsAliasTableRow> data) {

        List<CmsAliasTableRow> result = new ArrayList<CmsAliasTableRow>();
        for (CmsAliasTableRow row : data) {
            CmsAliasTableRow copiedRow = row.copy();
            result.add(copiedRow);
        }
        return result;
    }
745525
private synchronized void initCopy(CopyOperationImpl op) throws SQLException, IOException {
    pgStream.receiveInteger4(); // length not used
    int rowFormat = pgStream.receiveChar();
    int numFields = pgStream.receiveInteger2();
    int[] fieldFormats = new int[numFields];

    for (int i = 0; i < numFields; i++) {
      fieldFormats[i] = pgStream.receiveInteger2();
    }

    lock(op);
    op.init(this, rowFormat, fieldFormats);
  }
296104
@NonNull
  public static CreateTableStart createTable(@NonNull String tableName) {
    return createTable(CqlIdentifier.fromCql(tableName));
  }
652482
public void readData(FieldTable table) throws DBException
    {
        if (this.getLookupKey() instanceof String)
        {
            FieldList record = table.getRecord();
            String strTableName = (String)this.getLookupKey();
            String strDBName = null;
            if (strTableName != null)
            {
                if (strTableName.lastIndexOf('/') != -1)
                {
                    strDBName = strTableName.substring(0, strTableName.lastIndexOf('/'));
                    if (strDBName.lastIndexOf('/') != -1)
                        strDBName = strDBName.substring(strDBName.lastIndexOf('/') + 1);
                    strTableName = strTableName.substring(strTableName.lastIndexOf('/') + 1);
                    if (strTableName.indexOf('.') != -1)
                        strTableName = strTableName.substring(0, strTableName.indexOf('.'));
                }
            }

            String strThickRecordClass = record.getClass().getName();
            
            RecordOwner recordOwner = ((Record)record).getRecordOwner();
            BaseDatabase database = (BaseDatabase)recordOwner.getDatabase(record.getDatabaseName(), record.getDatabaseType(), null);
            Record recSource = Record.makeRecordFromClassName(strThickRecordClass, recordOwner, false, true);
            if (recSource == null)
                return;
            if (strTableName != null)
                if (strTableName.length() > 0)
                    if ((!strTableName.equalsIgnoreCase(recSource.getTableNames(false))))
                        if ((recSource.getDatabaseType() & DBConstants.MAPPED) != 0)
                            recSource.setTableNames(strTableName);
            recSource.setTable(database.makeTable(recSource));
            recSource.init(recordOwner);

            recSource.populateThinTable(record, true);
            
            recSource.free();
        }
    }
449422
public function copyTable(string $tableNameSource, string $tableNameDestination): bool
    {
        $tableNameSource = $this->quoter->quoteName($tableNameSource);
        $tableNameDestination = $this->quoter->quoteName($tableNameDestination);
        $this->db->exec(sprintf('CREATE TABLE %s LIKE %s;', $tableNameDestination, $tableNameSource));

        return true;
    }
969582
def create_table(self, table_name, obj=None, **kwargs):
        
        return self.client.create_table(
            table_name, obj=obj, database=self.name, **kwargs
        )
1178486
def tablerename(tablename, newtablename):
    
    t = table(tablename, ack=False)
    t.rename(newtablename)
477414
public Table createTable(String tableName,
            List<KeySchemaElement> keySchema,
            List<AttributeDefinition> attributeDefinitions,
            ProvisionedThroughput provisionedThroughput) {
        return createTable(new CreateTableRequest()
            .withTableName(tableName)
            .withKeySchema(keySchema)
            .withAttributeDefinitions(attributeDefinitions)
            .withProvisionedThroughput(provisionedThroughput));
    }
650108
public Table updateTableDescription(String datasetName, String tableName, String newDescription) {
    // [START bigquery_update_table_description]
    // String datasetName = "my_dataset_name";
    // String tableName = "my_table_name";
    // String newDescription = "new_description";

    Table beforeTable = bigquery.getTable(datasetName, tableName);
    TableInfo tableInfo = beforeTable.toBuilder().setDescription(newDescription).build();
    Table afterTable = bigquery.update(tableInfo);
    // [END bigquery_update_table_description]
    return afterTable;
  }
1353733
@Override
    public void writeJoinTableData(String tableName, Object rowId, Map<String, Object> columns, String columnFamilyName)
            throws IOException
    {
        Table hTable = gethTable(tableName);

        hbaseWriter.writeColumns(hTable, rowId, columns, columnFamilyName);

        closeHTable(hTable);
    }
1066604
public int create(DatabaseConnection databaseConnection, T data, ObjectCache objectCache) throws SQLException {
		if (mappedInsert == null) {
			mappedInsert = MappedCreate.build(dao, tableInfo);
		}
		int result = mappedInsert.insert(databaseType, databaseConnection, data, objectCache);
		if (dao != null && !localIsInBatchMode.get()) {
			dao.notifyChanges();
		}
		return result;
	}
204142
public CompletableFuture<Void> createTable(String tableName) {
        log.debug("create table called for table: {}", tableName);

        return Futures.toVoid(withRetries(() -> segmentHelper.createTableSegment(tableName, authToken.get(), RequestTag.NON_EXISTENT_ID),
                () -> String.format("create table: %s", tableName)))
                .whenCompleteAsync((r, e) -> {
                    if (e != null) {
                        log.warn("create table {} threw exception", tableName, e);
                    } else {
                        log.debug("table {} created successfully", tableName);
                    }
                }, executor);
    }
1235122
@Override
    public void writeData(String tableName, EntityMetadata m, Object entity, Object rowId,
            List<RelationHolder> relations, boolean showQuery) throws IOException
    {
        HTableInterface hTable = gethTable(tableName);

        MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                m.getPersistenceUnit());

        EntityType entityType = metaModel.entity(m.getEntityClazz());

        Set<Attribute> attributes = entityType.getAttributes();

        if (metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType()))
        {
            rowId = KunderaCoreUtils.prepareCompositeKey(m, rowId);
        }

        HBaseDataWrapper columnWrapper = new HBaseDataWrapper(rowId, new java.util.HashMap<String, Attribute>(),
                entity, null);
        List<HBaseDataWrapper> persistentData = new ArrayList<HBaseDataHandler.HBaseDataWrapper>(attributes.size());

        Map<String, HBaseDataWrapper> columnWrappers = preparePersistentData(tableName, m.getTableName(), entity,
                rowId, metaModel, attributes, columnWrapper, persistentData, showQuery);

        writeColumnData(hTable, entity, columnWrappers);

        for (HBaseDataWrapper wrapper : persistentData)
        {
            hbaseWriter.writeColumns(hTable, wrapper.getColumnFamily(), wrapper.getRowKey(), wrapper.getColumns(),
                    wrapper.getValues(), wrapper.getEntity());
        }

        // Persist relationships as a column in newly created Column family by
        // Kundera
        boolean containsEmbeddedObjectsOnly = columnWrapper.getColumns().isEmpty() && persistentData.isEmpty();

        if (relations != null && !relations.isEmpty())
        {
            hbaseWriter.writeRelations(hTable, rowId, containsEmbeddedObjectsOnly, relations, m.getTableName());
        }

        // add discriminator column
        String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn();
        String discrValue = ((AbstractManagedType) entityType).getDiscriminatorValue();

        // No need to check for empty or blank, as considering it as valid name
        // for nosql!
        if (discrColumn != null && discrValue != null)
        {
            List<RelationHolder> discriminator = new ArrayList<RelationHolder>(1);
            discriminator.add(new RelationHolder(discrColumn, discrValue));
            hbaseWriter.writeRelations(hTable, rowId, containsEmbeddedObjectsOnly, discriminator, m.getTableName());
        }

        puthTable(hTable);
    }
391333
@Override
    public java.util.concurrent.Future<UpdateTableResult> updateTableAsync(String tableName, ProvisionedThroughput provisionedThroughput) {

        return updateTableAsync(new UpdateTableRequest().withTableName(tableName).withProvisionedThroughput(provisionedThroughput));
    }
963433
public Table cloneTable()
    {
        Table ret = null;
        try {
            ret = (Table) super.clone();
        } catch (final CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return ret;
    }