database 使用二维码在数据库中存储信息

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20072335/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 09:07:59  来源:igfitidea点击:

use qr codes to store information in a database

databasestorebarcodeqr-codeinformation-retrieval

提问by user1264844

I am new to QR codes and wanted to know if it were possible for a QR code to storevalues into a database? For example, if a receipt printed out a QR code, and the company can scan the receipt's QR code to store details such as; the time of purchase, price etc.

我是二维码的新手,想知道二维码是否可以存储到数据库中?例如,如果收据打印出二维码,公司可以扫描收据的二维码来存储详细信息,例如;购买时间、价格等。

All instances of QR codes I have found so far are just retrieval of information rather than storing. Thanks for any help, again I am completely new to this technology and apologise if this question is really silly. I did use the search but I haven't found anything on the internet let alone here.

到目前为止,我发现的所有二维码实例都只是检索信息而不是存储。感谢您的帮助,我再次对这项技术完全陌生,如果这个问题真的很愚蠢,我深表歉意。我确实使用了搜索,但我没有在互联网上找到任何东西,更不用说这里了。

Thanks again for any help.

再次感谢任何帮助。

采纳答案by arkascha

In general that certainly is possible. Actually everyQRCode / barcode stores information. But usually the size of that information is pretty small. Typically only references like URLs or numbers (IDs) are stored and the 'real' data is retrieved froma database using those references. But strictly speaking that is a form of storing information in a QRCode / barcode.

一般来说,这当然是可能的。实际上每个二维码/条形码都存储信息。但通常该信息的大小非常小。通常只存储 URL 或数字 (ID) 等引用,并使用这些引用数据库中检索“真实”数据。但严格来说,这是一种在二维码/条形码中存储信息的形式。

Looking closely we see that the data is stored in the code itself, not inside a database if we are talking about that small amount of data. Certainly that data can be stored inside a database when the code is read, all you need is a trivial piece of software. But that makes little sense in most cases, since the data already isstored. If you want to use a database to combinedata from different sources, so if you only want to use codes as a means of transport, then reading the codes is just a replacement for typing the information in with a keyboard. So no magic here, nothing code specific you have to consider.

仔细观察我们会发现数据存储在代码本身中,而不是存储在数据库中,如果我们谈论的是少量数据。当然,当读取代码时,数据可以存储在数据库中,您只需要一个简单的软件即可。但是,这使得在大多数情况下没有什么意义,因为这些数据已存储。如果您想使用数据库来组合来自不同来源的数据,那么如果您只想使用代码作为传输手段,那么阅读代码只是替代用键盘输入信息。所以这里没有魔法,你不需要考虑任何特定的代码。

If you are talking about bigger amounts of data, then you have to use other types of codes. The one I like most are dataglyphs. They even provide a pretty big fault tolerance.

如果您正在谈论更大的数据量,那么您必须使用其他类型的代码。我最喜欢的是dataglyphs。它们甚至提供了相当大的容错能力。

回答by Kifnfik

QR-codes can only store information. Common use of QR-codes is to store an URL to a specific page within the QR-code matrix. The QR-code may then be read with a smartphone app. It is the app itself that will identify the contents of the QR-code as an URL.

二维码只能存储信息。QR 码的常见用途是将 URL 存储到 QR 码矩阵中的特定页面。然后可以使用智能手机应用程序读取二维码。应用程序本身会将二维码的内容识别为 URL。

In your case it would be possible to encode receipt information into the QR-code and then, via a specialized reader app, read and interpret the contents of the QR-code and make the app store it into a database.

在您的情况下,可以将收据信息编码到二维码中,然后通过专门的阅读器应用程序读取和解释二维码的内容,并使应用程序将其存储到数据库中。

回答by Bart Enkelaar

In essence, a QR code is just a certain way to represent information. In itself, the QR code will never interact with a database.

本质上,二维码只是一种表示信息的方式。二维码本身永远不会与数据库交互。

However, it would be fairly trivial to put the information you mention into an http request which you encode in a QR code. Whenever someone would then scan the QR code it could send this information to a web service which would store the data in a database.

但是,将您提到的信息放入您用二维码编码的 http 请求中是相当简单的。每当有人扫描二维码时,它就可以将此信息发送到网络服务,该服务将数据存储在数据库中。

Alternatively you could create your own scanning app which simply reads the data from the code and connects to a database, it all depends on how much control you have over the environment and how accessible you want everything to be.

或者,您可以创建自己的扫描应用程序,它只是从代码中读取数据并连接到数据库,这完全取决于您对环境的控制程度以及您希望所有内容的可访问性。

回答by Otto

I think it is possible, few cinemas have done it with QR Code to store customers data.

我认为这是可能的,很少有电影院使用二维码来存储客户数据。