Creates a result scanner
@param tableName
@param famName
@param conf
@return
@throws IOException
971239
public Scan getScan(String tableName,
             String famName) throws IOException {
         return getResultScan(tableName, famName, null, null);
     }
118815
public void write(ProgressVisitor progress, String tableName, File fileName, String encoding) throws SQLException, IOException {
        String regex = ".*(?i)\\b(select|from)\\b.*";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(tableName);
        if (matcher.find()) {
            if (tableName.startsWith("(") && tableName.endsWith(")")) {
                PreparedStatement ps = connection.prepareStatement(tableName, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
                ResultSet resultSet = ps.executeQuery();
                write(progress, resultSet, fileName, encoding);
            } else {
                throw new SQLException("The select query must be enclosed in parenthesis: '(SELECT * FROM ORDERS)'.");
            }
        } else {
            if (FileUtil.isExtensionWellFormated(fileName, "geojson")) {
                JsonEncoding jsonEncoding =  JsonEncoding.UTF8;
                if (encoding != null) {
                    try {
                        jsonEncoding = JsonEncoding.valueOf(encoding);
                    } catch (IllegalArgumentException ex) {
                        throw new SQLException("Only UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF-32LE encoding is supported");
                    }
                }
                
                FileOutputStream fos = null;
                try {
                    fos = new FileOutputStream(fileName);
                    int recordCount = JDBCUtilities.getRowCount(connection, tableName);
                    if (recordCount > 0) {
                        ProgressVisitor copyProgress = progress.subProcess(recordCount);
                        // Read Geometry Index and type
                        final TableLocation parse = TableLocation.parse(tableName, JDBCUtilities.isH2DataBase(connection.getMetaData()));
                        List<String> spatialFieldNames = SFSUtilities.getGeometryFields(connection, parse);
                        if (spatialFieldNames.isEmpty()) {
                            throw new SQLException(String.format("The table %s does not contain a geometry field", tableName));
                        }

                        try ( // Read table content
                            Statement st = connection.createStatement()) {
                            JsonFactory jsonFactory = new JsonFactory();
                            JsonGenerator jsonGenerator = jsonFactory.createGenerator(new BufferedOutputStream(fos), jsonEncoding);

                            // header of the GeoJSON file
                            jsonGenerator.writeStartObject();
                            jsonGenerator.writeStringField("type", "FeatureCollection");
                            writeCRS(jsonGenerator, SFSUtilities.getAuthorityAndSRID(connection, parse, spatialFieldNames.get(0)));
                            jsonGenerator.writeArrayFieldStart("features");

                            ResultSet rs = st.executeQuery(String.format("select * from %s", tableName));

                            try {
                                ResultSetMetaData resultSetMetaData = rs.getMetaData();
                                int geoFieldIndex = JDBCUtilities.getFieldIndex(resultSetMetaData, spatialFieldNames.get(0));
                                cacheMetadata(resultSetMetaData);
                                while (rs.next()) {
                                    writeFeature(jsonGenerator, rs, geoFieldIndex);
                                    copyProgress.endStep();
                                }
                                copyProgress.endOfProgress();
                                // footer
                                jsonGenerator.writeEndArray();
                                jsonGenerator.writeEndObject();
                                jsonGenerator.flush();
                                jsonGenerator.close();

                            } finally {
                                rs.close();
                            }
                        }
                    }
                } catch (FileNotFoundException ex) {
                    throw new SQLException(ex);

                } finally {
                    try {
                        if (fos != null) {
                            fos.close();
                        }
                    } catch (IOException ex) {
                        throw new SQLException(ex);
                    }
                }
            } else {
                throw new SQLException("Only .geojson extension is supported");
            }
        }
    }
75551
def create_tablefn_map(fns, pqdb, poolnames):
    """"""
    poolmap = {name: pid for (name, pid) in pqdb.get_all_poolnames()}
    pqdb.store_table_files([(poolmap[pool], os.path.basename(fn))
                            for fn, pool in zip(fns, poolnames)])
    return pqdb.get_tablefn_map()
1057633
@Override
    public void deleteByColumn(String tableName, String colFamily, String columnName, Object columnValue)
    {
        try
        {
            String hTableName = HBaseUtils.getHTableName(tableName, colFamily);
            handler.deleteRow(columnValue, columnName, colFamily, hTableName);
        }
        catch (IOException ioex)
        {
            log.error("Error during get columns by key. Caused by: .", ioex);
            throw new PersistenceException(ioex);
        }
    }
1310865
private void processColumnData(ProjectFile file, Table table, byte[] data)
   {
      //System.out.println("Table=" + table);
      //System.out.println(ByteArrayHelper.hexdump(data, 12, data.length-12, true, 115, ""));

      if (data != null)
      {
         int columnCount = MPPUtility.getShort(data, 4) + 1;
         int index = 12;
         Column column;
         int alignment;

         for (int loop = 0; loop < columnCount; loop++)
         {
            column = new Column(file);
            int fieldType = MPPUtility.getShort(data, index);
            if (table.getResourceFlag() == false)
            {
               column.setFieldType(MPPTaskField14.getInstance(fieldType));
            }
            else
            {
               column.setFieldType(MPPResourceField14.getInstance(fieldType));
            }

            //System.out.println(fieldType);

            //            if (column.getFieldType() == null)
            //            {
            //               System.out.println(loop + ": Unknown column type " + fieldType);
            //            }
            //            else
            //            {
            //               System.out.println(loop + ": " + column.getFieldType());
            //            }

            column.setWidth(MPPUtility.getByte(data, index + 4));

            String columnTitle = MPPUtility.getUnicodeString(data, index + 13);
            if (columnTitle.length() != 0)
            {
               column.setTitle(columnTitle);
            }

            alignment = MPPUtility.getByte(data, index + 5);
            if ((alignment & 0x0F) == 0x00)
            {
               column.setAlignTitle(Column.ALIGN_LEFT);
            }
            else
            {
               if ((alignment & 0x0F) == 0x01)
               {
                  column.setAlignTitle(Column.ALIGN_CENTER);
               }
               else
               {
                  column.setAlignTitle(Column.ALIGN_RIGHT);
               }
            }

            alignment = MPPUtility.getByte(data, index + 7);
            if ((alignment & 0x0F) == 0x00)
            {
               column.setAlignData(Column.ALIGN_LEFT);
            }
            else
            {
               if ((alignment & 0x0F) == 0x01)
               {
                  column.setAlignData(Column.ALIGN_CENTER);
               }
               else
               {
                  column.setAlignData(Column.ALIGN_RIGHT);
               }
            }

            table.addColumn(column);
            index += 115;
         }
      }
   }
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);
    }
619729
@Override
	public Scan open() {
		Scan s = p1.open();
		// throws an exception if p2 is not a tableplan
		TableScan ts = (TableScan) tp2.open();
		Index idx = ii.open(tx);
		return new IndexJoinScan(s, idx, joinFields, ts);
	}
117339
public Table createTable(String datasetName, String tableName, String fieldName) {
    // [START bigquery_create_table]
    TableId tableId = TableId.of(datasetName, tableName);
    // Table field definition
    Field field = Field.of(fieldName, LegacySQLTypeName.STRING);
    // Table schema definition
    Schema schema = Schema.of(field);
    TableDefinition tableDefinition = StandardTableDefinition.of(schema);
    TableInfo tableInfo = TableInfo.newBuilder(tableId, tableDefinition).build();
    Table table = bigquery.create(tableInfo);
    // [END bigquery_create_table]
    return table;
  }
735228
private void createIndex(String tableName, String indexName, String... fieldNames)
    {
        StringBuilder builder = new StringBuilder();
        builder.append("CREATE INDEX IF NOT EXISTS ");
        builder.append(indexName);
        builder.append(" ON ");
        builder.append(tableName);
        builder.append(Constants.OPEN_ROUND_BRACKET);
        for (String fieldName : fieldNames)
        {
            builder.append(fieldName);
            builder.append(Constants.COMMA);
        }
        builder.deleteCharAt(builder.length() - 1);
        builder.append(Constants.CLOSE_ROUND_BRACKET);
        StatementResult result = tableAPI.executeSync(builder.toString());
        if (!result.isSuccessful())
        {
            throw new SchemaGenerationException("Unable to CREATE Index with Index Name [" + indexName
                    + "] for table [" + tableName + "]");
        }
    }
564742
private void processTableData() throws IOException
   {
      DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CTable");
      FixFix ff = new FixFix(126, new DocumentInputStream(((DocumentEntry) dir.getEntry("FixFix   0"))));
      FixDeferFix fdf = new FixDeferFix(new DocumentInputStream(((DocumentEntry) dir.getEntry("FixDeferFix   0"))));
      int items = ff.getItemCount();
      StringBuilder sb = new StringBuilder();
      TableContainer container = m_file.getTables();

      for (int loop = 0; loop < items; loop++)
      {
         byte[] data = ff.getByteArrayValue(loop);
         Table table = new Table();

         table.setID(MPPUtility.getInt(data, 0));

         String name = MPPUtility.getUnicodeString(data, 4);
         if (name.indexOf('&') != -1)
         {
            sb.setLength(0);
            int index = 0;
            char c;

            while (index < name.length())
            {
               c = name.charAt(index);
               if (c != '&')
               {
                  sb.append(c);
               }
               ++index;
            }

            name = sb.toString();
         }

         table.setName(MPPUtility.removeAmpersands(name));
         container.add(table);

         byte[] extendedData = fdf.getByteArray(getOffset(data, 122));
         if (extendedData != null)
         {
            byte[] columnData = fdf.getByteArray(getOffset(extendedData, 8));
            processColumnData(table, columnData);
         }

         //System.out.println(table);
      }
   }
768942
public void createGenerator (Connection conn, String tableName, String columnName, int initValue)
        throws SQLException
    {
        if (initValue == 1) {
            return; // that's the default! yay, do nothing
        }

        String seqname = "\"" + tableName + "_" + columnName + "_seq\"";
        Statement stmt = conn.createStatement();
        try {
            stmt.executeQuery("select setval('" + seqname + "', " + initValue + ", false)");
        } finally {
            JDBCUtil.close(stmt);
        }
        log("Initial value of " + seqname  + " set to " + initValue + ".");
    }
1234369
public void snapshot(byte[] snapshotName, byte[] tableName)
      throws IOException, IllegalArgumentException {
    snapshot(snapshotName, TableName.valueOf(tableName));
  }
227226
private void processTableData() throws IOException
   {
      DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CTable");

      VarMeta varMeta = new VarMeta12(new DocumentInputStream(((DocumentEntry) dir.getEntry("VarMeta"))));
      Var2Data varData = new Var2Data(varMeta, new DocumentInputStream(((DocumentEntry) dir.getEntry("Var2Data"))));
      FixedData fixedData = new FixedData(230, new DocumentInputStream(((DocumentEntry) dir.getEntry("FixedData"))));
      //System.out.println(varMeta);
      //System.out.println(varData);
      //System.out.println(fixedData);

      TableContainer container = m_file.getTables();
      TableFactory14 factory = new TableFactory14(TABLE_COLUMN_DATA_STANDARD, TABLE_COLUMN_DATA_ENTERPRISE, TABLE_COLUMN_DATA_BASELINE);
      int items = fixedData.getItemCount();
      for (int loop = 0; loop < items; loop++)
      {
         byte[] data = fixedData.getByteArrayValue(loop);
         Table table = factory.createTable(m_file, data, varMeta, varData);
         container.add(table);
         //System.out.println(table);
      }
   }
1273368
private void chooseSampleSqlAndConf(BufferedReader br) throws IOException {
        while (true) {
            printInstruction("Which sample SQL schema would you like to use?");
            for (int i = 0; i < getSqlConfInfos().size(); i++) {
                System.out.println(" " + (i + 1) + ") " + getSqlConfInfos().get(i).getName());
                System.out.println("    " + getSqlConfInfos().get(i).getDescription());
                if (getSqlConfInfos().get(i).getDescription2() != null) {
                    System.out.println("    " + getSqlConfInfos().get(i).getDescription2());
                }
                System.out.println("");
            }

            String choice = br.readLine();
            if (isBlank(choice)) {
                continue;
            } else {
                try {
                    sqlConfName = getSqlConfInfos().get(Integer.parseInt(choice) - 1).getName();
                    System.out.println("OK, using: " + sqlConfName);
                } catch (Exception e) {
                    System.out.println("");
                    continue;
                }
            }
            break;
        }
    }
700874
protected Scan createScanner(Configuration parameters) {
		Scan scan = null;
		if (parameters.getString(SCAN, null) != null) {
			try {
				scan = HBaseUtil.convertStringToScan(parameters.getString(SCAN, null));
			} catch (IOException e) {
				LOG.error("An error occurred.", e);
			}
		} else {
			try {
				scan = new Scan();

				// if (parameters.getString(SCAN_COLUMNS, null) != null) {
				// scan.addColumns(parameters.getString(SCAN_COLUMNS, null));
				// }

				if (parameters.getString(SCAN_COLUMN_FAMILY, null) != null) {
					scan.addFamily(Bytes.toBytes(parameters.getString(SCAN_COLUMN_FAMILY, null)));
				}

				if (parameters.getString(SCAN_TIMESTAMP, null) != null) {
					scan.setTimeStamp(Long.parseLong(parameters.getString(SCAN_TIMESTAMP, null)));
				}

				if (parameters.getString(SCAN_TIMERANGE_START, null) != null
					&& parameters.getString(SCAN_TIMERANGE_END, null) != null) {
					scan.setTimeRange(
						Long.parseLong(parameters.getString(SCAN_TIMERANGE_START, null)),
						Long.parseLong(parameters.getString(SCAN_TIMERANGE_END, null)));
				}

				if (parameters.getString(SCAN_MAXVERSIONS, null) != null) {
					scan.setMaxVersions(Integer.parseInt(parameters.getString(SCAN_MAXVERSIONS, null)));
				}

				if (parameters.getString(SCAN_CACHEDROWS, null) != null) {
					scan.setCaching(Integer.parseInt(parameters.getString(SCAN_CACHEDROWS, null)));
				}

				// false by default, full table scans generate too much BC churn
				scan.setCacheBlocks((parameters.getBoolean(SCAN_CACHEBLOCKS, false)));
			} catch (Exception e) {
				LOG.error(StringUtils.stringifyException(e));
			}
		}
		return scan;
	}
78091
public void tableEntry(CodeBuilder mv) {
    mv.visitLocalVariable(
        variableName(),
        resultType().getDescriptor(),
        null, // no generic signature
        start(),
        end(),
        index());
  }
493422
private String buildCreateTableQuery(final IClassContainer container,
                                         final String primaryKeyField) {
        final StringBuilder builder = new StringBuilder("CREATE TABLE IF NOT EXISTS ")
                .append(container.getExportClassName().toLowerCase())
                .append("(\n");

        final String resultValues = container.getFormatSupported(Format.SQL).entrySet().stream()
                .map(e -> "\t" + buildInsertNameTypeQuery(e.getValue().getExportName(), container))
                .collect(Collectors.joining(",\n"));

        builder.append(resultValues);

        // Write primary key constraint
        return builder.append(",\n")
                .append("\tPRIMARY KEY (")
                .append(primaryKeyField)
                .append(")\n);\n")
                .toString();
    }