LENGTH()查询与数据的实际大小有什么关系?我注意到,当我将这些数据保存到文本文件中时,它大约比LENGTH()查询大2%。这里发生了什么事?下面是一个在linux上使用MariaDB 10.3.16的例子。du和ls都同意。
$ mysql -ufugu -p projects -e "SELECT ID, LENGTH(CutXML) as length FROM renders ORDER BY length DESC LIMIT 1"
Enter password:
+-----+---------+
| ID | length |
+-----+------
在下面的代码中,getArchives()是一个远程API。getArchives()返回一个超大的JSON,大于100 MB,将来可能更大。
public void syncArchive() {
// the json is so large, I'm wondering it's appropriate to use java.lang.String to hold it
String data = dataService.getArchives();
// convert data to List<Archive> and the
我正在进行一个项目,该项目将将许多类型的对象保存到数据库中。包括:文章,民意测验,作家..。等等,其中一些在设计时对我来说是未知的,所以我要做的是构建一个通用的表模式,使我能够将任何类型的项保存到这个数据库中。
我的设计
表对象
objectID int
title varchar
body text
type int #will represent the ID of the type of object am inserting
鉴于这种情况或需求可能需要更多数据,我决定将其应用到我所称的“对象元数据”中,如下所示:
表Object_MetaData
metaID int
metaKey
我有一个带有<br>标签的文本,我想将它作为新行保存到MySQL数据库中。而不是HTML标记。
例如:
$string = 'some text with<br>tags here.'
我想像这样把它保存到MySQL中:
some text with tags here
用于此目的的正确str_replace是什么?谢谢。