@param $table da base de dados
@param $data recebido do array

@return bool
513882
public function insert($table, array $data)
     {
         try {
             krsort($data);

             $fieldNme = implode('`,`', array_keys($data));
             $fieldValues = ':'.implode(',:', array_keys($data));
             $this->_beginTransaction();

             $stmt = $this->conn->prepare("INSERT INTO $table (`$fieldNme`) VALUES ($fieldValues)");

             foreach ($data as $key => $values) {
                 $stmt->bindValue(":$key", $values);
             }
             $this->_commit();
             $stmt->execute();
             unset($stmt);
         } catch (Exception $e) {
             $this->_Rollback();
             echo 'error insert '.$e->getMessage();
         }
     }
511371
public function setData(string $table, $data){
            
            $file = $this->base . '/' . $table . '.json';
            if(file_exists($file)){
                if(file_put_contents($file, json_encode($data))){
                    $status = true;
                }else{
                    $status = false;
                }
                return new \NonDB\Components\Status($status);
            }else{
                throw new \NonDB\Exceptions\DriverException('Table Not Exists.', 1002);
            }

        }
1190677
public function create(string $table, array $data)
    {
        $data['created_at']=time();
        $this->db->insert($table, $data);
        $id=$this->db->id();
        if ($id) {
            return $id;
        } else {
            return false;
        }
    }
445935
public function insert($table, $data)
    {
        // empty data
        if (empty($data))
            Throw new \ErrorException("SQL Error: Can't insert empty data.");

        // prepare data
        $cols = ($values = array());
        foreach ($data as $column => $value) {
            $cols[] = '`' . $column . '`';
            $values[] = "'" . $this->escape($value) . "'";
        }

        // build query string...
        $query_string = 'INSERT INTO `' . $this->getPrefix() . $table . '` (' . implode(',', $cols) . ') VALUES (' . implode(',', $values) . ')';

        return $this->doQuery($query_string); // ... and execute
    }
963885
protected function _tableExists($table)
    {
        $db = ConnectionManager::get('default');
        $tables = $db->schemaCollection()->listTables();

        return in_array($table, $tables);
    }
941750
public function hasTable($table)
    {
        if (is_array($schema = $this->connection->getConfig('schema'))) {
            $schema = head($schema);
        }

        $table = $this->connection->getTablePrefix() . $table;

        return count($this->connection->select(
            $this->grammar->compileTableExists(),
            [$schema, $table]
        )) > 0;
    }
1006801
public function update($table, $data, $where = '')
    {
        $fieldDetails = null;
        foreach ($data as $key => $value) {
            $fieldDetails .= "$key = :$key,";
        }
        $fieldDetails = rtrim($fieldDetails, ',');
        $query = "UPDATE $table SET $fieldDetails ".($where ? 'WHERE '.$where : '');
        $this->prepare($query);

        foreach ($data as $key => $value) {
            $this->bind(":$key", $value);
        }
        try {
            $this->execute();

            return true;
        } catch (PDOException $e) {
            echo $e->errorInfo[2];

            return false;
        }
    }
1163409
public function update($table, $data, $where)
     {
         ksort($data);

         $fielDetail = null;

         foreach ($data as $key => $values) {
             $fielDetail .= "`$key`=:$key,";
         }

         $fielDetail = trim($fielDetail, ',');
         $stmt = $this->conn->prepare("UPDATE $table SET $fielDetail WHERE $where ");
         foreach ($data as $key => $values) {
             $stmt->bindValue(":$key", $values);
         }

         return $stmt->execute();
     }
578062
public function insert($table, array $data)
    {
        $table = $this->getTable($table);
        $field = implode(', ', array_keys($data));

        $placeholder = array();
        foreach ($data as $key => $value) {
            if ($value instanceof \stdClass && isset($value->scalar)) {
                $placeholder[] = $value->scalar;
                unset($data[$key]);
            } else {
                $placeholder[] = '?';
            }
        }
        $placeholder = implode(', ', $placeholder);

        $query = "INSERT INTO $table ($field) VALUES ($placeholder)";
        return $this->executeUpdate($query, array_values($data));
    }
153447
public function seeInDatabase($table, array $data)
    {
        return $this->assertInDatabase($table, $data, sprintf(
            "Didn't see row in the '%s' table that matched the attributes '%s'.",
            $table, json_encode($data)
        ));
    }
1311062
public function delete($table, $data, $keys, $options = []) {
		return $this->object->delete($table, $data, $keys, $options);
	}
171854
public function ExecuteInsert($table, $data)
    {
            if (is_object($data))
                ModelState::ModelTreatment($data);

            $data = (array)$data;

            // Ordena
            ksort($data);

            // Campos e valores
            $camposNomes = implode('`, `', array_keys($data));
            $camposValores = ':' . implode(', :', array_keys($data));

            // Prepara a Query
            $sth = $this->prepare("INSERT INTO $table (`$camposNomes`) VALUES ($camposValores)");

            // Define os dados
            foreach ($data as $key => $value) {
                // Se o tipo do dado for inteiro, usa PDO::PARAM_INT, caso contr�rio, PDO::PARAM_STR
                $tipo = (is_int($value)) ? PDO::PARAM_INT : PDO::PARAM_STR;

                // Define o dado
                $sth->bindValue(":$key", $value, $tipo);
            }

            // Executa
            $sth->execute();

            // Retorna o ID desse item inserido
            return $this->lastInsertId();
    }
577007
public function create($table, $data)
    {
        $query = 'CREATE TABLE IF NOT EXISTS `' . $table . '` (';

        foreach ($data as $column => $value) {
            $query .= $column . ' ' . $value . ', ';
        }

        $query = rtrim(trim($query), ',') . ')'; // Remove final comma

        return $this->query($query);
    }
6263
public function replace($table, $data) {

        $_fileds = '';
        $_values = '';
        $_T_fields = $this->getTableFields($table);
        foreach ( $data as $_key => $_val ) {

            //自动过滤掉不存在的字段
            if ( !in_array( $_key, $_T_fields ) ) continue;

            $_fileds .= ( $_fileds=='' ) ? "`{$_key}`" : ", `{$_key}`";
            if ( is_null($_val) ) {
                $_val = 'NULL';
            } else {
                $_val = "'{$_val}'";
            }
            $_values .= ( $_values=='' ) ? "{$_val}" : ",{$_val}";
        }

        if ( $_fileds != '' ) {
            $_query = "REPLACE INTO {$table}(" . $_fileds . ") VALUES(" . $_values . ")";
            if ( $this->execute($_query) != false ) {
                return true;
            }

        }
        return false;
    }
331627
public static function create($table, $data, $option = false)
    {
        $db = self::Using(self::$using_dbo_id);
        return $db->create($table, $data, $option);
    }
686839
public function hasTable($table) {
        //$sql = $this->grammar->compileTableExists();
        $table = $this->connection->getTablePrefix() . $table;
        return count($this->connection->select(array($table))) > 0;
    }
1208998
public function haveInDatabase($table, array $data)
    {
        $lastInsertId = $this->_insertInDatabase($table, $data);

        $this->addInsertedRow($table, $data, $lastInsertId);

        return $lastInsertId;
    }