在MySQL中的二进制数据

44 浏览
0 Comments

在MySQL中的二进制数据

已关闭。这个问题需要更加专注。目前无法接受答案。


想要改善这个问题?通过编辑这篇文章,让问题专注于一个问题。

改善这个问题

如何在MySQL中存储二进制数据?

admin 更改状态以发布 2023年5月22日
0
0 Comments

对于这样的表格:

CREATE TABLE binary_data (
    id INT(4) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    description CHAR(50),
    bin_data LONGBLOB,
    filename CHAR(50),
    filesize CHAR(50),
    filetype CHAR(50)
);

这里是一个 PHP 示例:


    // Example php script to demonstrate the storing of binary files into
    // an sql database. More information can be found at https://www.phpbuilder.com/
?>

    Store binary data into SQL Database
    
        This file has the following Database ID: $id";
                mysql_close();
            } else {
                // else show the form to submit new data:
        ?>
        
File Description: File to upload/store in database:

0
0 Comments

php先生的答案是正确的,但我认为额外的细节中存在很多混淆。

基本答案在BLOB数据类型/属性域中。 BLOB简称Binary Large Object,该列数据类型专门处理二进制数据。

请参阅 MySQL的相关手册页面

0