英文:
Rewriting MS stack: jQuery/C#/SQL Server
问题
我被委托重新编写一个使用jQuery(前端)、C#.NET(后端)和MS SQL Server(数据存储)构建的项目。
我想用Go或Python/Django重新编写。对于这个项目,什么样的数据存储方式是令人满意的?请注意:由于涉及货币交易,它需要是关系型的。
谢谢。
英文:
I was tasked with re-writing a project that's build with jQuery (front-end), C#.NET (backend) and MS SQL Server (data storage).
I wanted to re-write in Go or Python/Django. What is a satisfactory data store to go with this? Note: It needs to be relational as there are monetary transactions involved.
Thanks
答案1
得分: 2
无论是MySQL还是PostGres都可以很好地工作。如果你对这两个存储引擎都不熟悉,我个人认为MySQL更容易上手,但是在你描述的项目范围内,它们都能很好地满足你的需求。
你可能会从不同的人那里得到不同的答案,但是要知道,在任何合理的应用程序中,它们在功能上是相同的,除非你特别想利用引擎的微小内部工作性能。
无论你选择哪种方式,我强烈建议使用支持事务的数据存储(即BEGIN... COMMIT... ROLLBACK...
),以确保你的读写操作按照你的预期进行,并且数据返回的方式与输入时的样子相同。我相信PostGres默认支持事务,而对于MySQL,你需要明确地使用INNODB引擎:
CREATE TABLE customers (
a INT,
b CHAR (20),
INDEX (a)
) ENGINE=InnoDB;
BEGIN;
INSERT INTO `customers`(`a`,`b`) VALUES(...)
COMMIT;
英文:
Either MySQL or PostGres will work just fine. I personally find MySQL to be more accessible if you're new to both storage engines, however they both will serve you well given the scope of the project you've described.
You will most likely get a different answer from most people you ask, however do know that they are functionally the same for any reasonable application where you are not specifically trying to leverage the performance of minute inner workings of the engines.
Whatever route you choose, I highly recommend using a datastore that supports transactions ( i.e. BEGIN... COMMIT... ROLLBACK...
) to ensure your reads and writes happen as you expect them to, and the data comes back out the way it looked going in. PostGres supports this by default I believe, while with MySQL, you'll want to specifically use the INNODB engine:
CREATE TABLE customers (
a INT,
b CHAR (20),
INDEX (a)
) ENGINE=InnoDB;
BEGIN;
INSERT INTO `customers`(`a`,`b`) VALUES(...)
COMMIT;
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论