自定义表名

@param string|array $type
@param string $tableName
769257
public static function setTableName($type = 'access', $tableName = 'access')
    {
        if (is_array($type)) {
            self::$tables = array_merge(self::$tables, $type);
        } else {
            self::$tables[$type] = $tableName;
        }
    }
71702
protected function validate($key, $tablename)
    {
        if (!$this->enabled) {
            return false;
        }
        $castType = $this->getCastType($key);
        if ($castType !== $this->castName) {
            return false;
        }
        if (!$this->isAesCastable($key, $tablename)) {
            return false;
        }
        if (!in_array(Schema::getColumnType($tablename, $key), $this->columnTypes)) {
            return false;
        }
        return true;
    }
1138828
function delete(string $tableName, $wheres = null)
  {
    if ($wheres === null)
    {
      $this->q("truncate $tableName");
    }
    else if (is_int($wheres) || (is_string($wheres) && ctype_digit($wheres)))
    {
      // 'wheres' is an ID value
      $this->q("delete from $tableName where id=$wheres");
    }
    else
    {
      assert(is_array($wheres));
      $wClause = implode(" and ", $this->makeClauses($wheres));
      $this->q("delete from $tableName where $wClause");
    }

    return $this->affected_rows;
  }
898296
public function addCustomFields($fieldName, $type, $addIndex)
    {
        if (!$this->table->hasColumn($fieldName)) {
            $this->{$this->typeMap[$type]}($fieldName);
        }

        if ($addIndex) {
            $this->table->addIndex([$fieldName]);
        }
    }
117989
protected function construct($tableName, array $data): void
    {
        // 保存表对象
        $this->table = self::makeTable($tableName);

        // 保存表名
        $this->tableName = $this->table->name();

        // 保存数据
        $this->data = $data;

    }
320163
public function join($table, $type = null)
	{
		$this->_join[] = $this->_last_join = new \Database_Query_Builder_Join($table, $type);

		return $this;
	}
148513
protected function createTable($tableName, $table) {
		$res = "\$this->schema->create('$tableName', function(\$table) {";

		foreach($table->getColumns() as $colName=>$col)
			$res .= $this->createColumn($colName, $col);

		foreach($table->getIndexes() as $index)
			$res .= $this->createIndex($index);

		foreach($table->getForeignKeys() as $key)
			$res .= $this->createForeignKey($key);

		$res .= "\n});\n\n";

		return $res;
	}
340547
public function set($data, $tableName = null, $tablePrefix = null)
    {
        is_null($tableName) && $tableName = $this->getTableName();
        is_null($tablePrefix) && $tablePrefix = $this->tablePrefix;
        return $this->db($this->getDbConf())->set($tableName, $data, $tablePrefix);
    }
12703
public function dropTable($tableName)
    {
        $this->db->query('SET FOREIGN_KEY_CHECKS = 0;');
        $this->db->query("DROP TABLE IF EXISTS `{$this->getTableNamePrefix($tableName)}`;");
        $this->db->query('SET FOREIGN_KEY_CHECKS = 1;');  
    }
464205
public function bindColumn($column, &$param, $type=null, $maxlen=null, $driver=null)
    {
        $column = is_numeric($column) ? $column : strtoupper($column);
        $this->_binds[$column] = &$param;
    }
146932
public static function toDoctrineTypeName($type)
    {
        $typeMap = self::getDoctrineTypeMap();

        if (!array_key_exists($type, $typeMap)) {
            throw new SystemException(sprintf('Unknown column type: %s', $type));
        }

        return $typeMap[$type];
    }
725064
private function makeTableHeader($type, $header, $colspan = 2)
    {
        if (!$this->bInitialized) {
            $header = $this->getVariableName() . " (" . $header . ")";
            $this->bInitialized = true;
        }
        $str_i = ($this->bCollapsed) ? "style=\"font-style:italic\" " : "";

        echo "<table cellspacing=2 cellpadding=3 class=\"dBug_" . $type . "\">
                <tr>
                    <td " . $str_i . "class=\"dBug_" . $type . "Header\" colspan=" . $colspan . " onClick='dBug_toggleTable(this)'>" . $header . "</td>
                </tr>";
    }
586713
public static function existsTable($tableName)
    {
        if ($tableName === '') {
            throw new \InvalidArgumentException('The table name must not be empty.', 1331315636);
        }

        self::retrieveTableNames();

        return isset(self::$tableNameCache[$tableName]);
    }
894691
private function createTable(DBALSchema $schema, string $schemaName, TypeSchema $type)
    {
        $table = $schema->createTable($this->tableName($schemaName, $type->name()));
        $table->addColumn('id', 'guid');
        $table->setPrimaryKey(['id']);

        foreach ($type->getDefinitions(['id']) as $field => $definition) {
            $this->typeRegistry->map($schemaName, $table, $field, $definition);
        }
    }
544827
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null)
    {
        switch ($type) {
            case ParameterType::INTEGER:
            case ParameterType::BOOLEAN:
                $type = 'i';
                break;

            case ParameterType::LARGE_OBJECT:
                $type = 'b';
                break;

            case ParameterType::NULL:
            case ParameterType::STRING:
            case ParameterType::BINARY:
                $type = 's';
                break;

            default:
                throw new SQLAnywhereException('Unknown type: ' . $type);
        }

        $this->boundValues[$column] =& $variable;

        if (! sasql_stmt_bind_param_ex($this->stmt, $column - 1, $variable, $type, $variable === null)) {
            throw SQLAnywhereException::fromSQLAnywhereError($this->conn, $this->stmt);
        }

        return true;
    }
874321
public function insert($tableName, array $data, array $types = []): int
    {
        $modified = $this->shallModifyIdentityInsert($data)
            && $this->modifyIdentityInsert($tableName, true);

        $result = parent::insert($tableName, $data, $types);

        if ($modified) {
            $this->modifyIdentityInsert($tableName, false);
        }

        return $result;
    }
977552
public function generateTableName($tableName)
    {
        if (!$this->useTablePrefix) {
            return $tableName;
        }

        $db = $this->getDbConnection();
        if (preg_match("/^{$db->tablePrefix}(.*?)$/", $tableName, $matches)) {
            $tableName = '{{%' . $matches[1] . '}}';
        } elseif (preg_match("/^(.*?){$db->tablePrefix}$/", $tableName, $matches)) {
            $tableName = '{{' . $matches[1] . '%}}';
        }
        return $tableName;
    }