- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在现有的 MSSQL 数据库中有几十个表autonumber ID 主键,但没有名为“id”的主键。他们是而是命名为 PropertyID、ClientID 等。官方文档似乎建议将这些字段中的每一个重命名为“id”:
Legacy Databases
web2py can connect to legacy databases under some conditions:
- Each table must have a unique auto-increment integer field called "id"
- Records must be referenced exclusively using the "id" field.
If these conditions are not met, it is necessary to manually ALTER TABLE to conform them to these requirements, or they cannot be accessed by web2py.
This should not be thought of as a limitation, but rather, as one of the many ways web2py encourages you to follow good practices.
但是,这需要打破其他领域的数百个现有查询使用此数据库的应用程序。肯定有办法指定要使用的现有自动编号字段的名称,而不是'id'。
这似乎是
Django got it right的区域和
web2py got it horribly wrong .还是我只是错过了什么?
似乎我只是错过了什么......
最佳答案
该声明已过时。 web2py支持的三种情况:
一个表有一个不叫'id'的自增字段,定义这个表
db.define_table('name',Field('id_name','id'),...其他字段...)
一个表有不同的主键
db.define_table('name',...fields..., primarykey=[....])
主键是字段名称列表。
选项 3 不适用于所有支持的数据库,但可以轻松扩展。我们只是没有收到太多要求,所以我们没有足够的测试人员来测试所有可能的选项。请将此讨论移至 web2py 邮件列表,我们很乐意为您提供更多帮助。
关于python - 在 web2py 中,我可以将现有命名字段指定为遗留数据库中的自动编号 ID 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3230504/
我正在为一个站点构建 flexbox,而新版本非常棒——完全按预期工作。但是,因为我们使用 wkhtmltopdf 呈现为 PDF,所以看起来我们需要暂时支持遗留 (webkit-*) flexbox
我有一个遗留的 GDB 命令脚本,用于基于 Python 2.6 源代码附带的 GDB 脚本获取 Python 堆栈跟踪(所以不允许超链接,但这是 URL:http://#%20http ://svn
$ sudo apt-get 安装 nodejs-legacy阅读包裹 list ...完成构建依赖树 正在读取状态信息...完成E: 无法定位包 node-legacy 请提出解决方案... 最佳答
我最近有幸获准在中型遗留代码库(从 3.x 到 5.2)中更改 Hibernate 依赖项(以及其他)的版本。代码本身已有 10 多年的历史,但仍在日常使用中。 因此,即使在增加版本并将尽可能多的 A
我正在尝试在 Debian GNU/Linux 稳定系统上编译一些较旧的 C++ 代码(可能来自 2001-2002 年左右)。编译时出现错误: In file included from /usr/
为 unix 上的一些遗留 c/c++ 代码寻找代码分析工具专门用于识别对 的依赖 具体职能 特定(包括?)文件 文件/套接字 I/O 调用等 来自根等的函数依赖树 最佳答案 Doxygen 可能就是
已结束。此问题不符合 Stack Overflow guidelines .它目前不接受答案。 我们不允许提出有关书籍、工具、软件库等方面的建议的问题。您可以编辑问题,以便用事实和引用来回答它。 关闭
我必须从遗留的 Visual Basic 软件中复制一个算法,但有一点我不理解代码。 作者似乎使用了某种方式通过引用隐式传递整数等简单数据类型。第一次我认为它可能是原始软件中的错误,但第三次出现后它看
我需要以编程方式最小化和最大化全屏 16 位应用程序。不幸的是,DosBox 不是一个选项,因为这个应用程序与 DosBox 不支持的一些外围设备对话。 我能够编写可以设置焦点、发送 alt + en
我想拦截对遗留 Java servlet/JSP 应用程序的请求,并使用 OpenID Connect (OIDC) 协议(protocol)对用户进行身份验证。 我看过 Spring Securit
我有一个遗留的 tomcat Java 应用程序(Spring、Hibernate、MySQL) 在 Linux (Ubuntu) 上运行。我想(需要)利用现有应用程序的后端数据库构建一个 Andro
我刚刚更新了我们的应用程序以使用最新版本的遗留 NVP API,并发现提到了巴西显然需要的两个新字段(TAXIDTYPE、TAXID)。这些显然是在我们之前使用的 API 版本之后引入的。 我只是尝试
我正在使用 g++ 4.4.7 编译一段非常古老的遗留代码。关于这段代码,我真正知道的是它是在 Irix/Sun 系统上开发的,这意味着它具有 MIPS 体系结构。我在使用这段代码时发现的一件相当奇怪
我们正在考虑使用托管 C++ 为一些遗留 C++ 库编写 .Net 可调用包装器。 这一切看起来都很简单。有什么需要注意的吗? 最佳答案 我发现在 C++/CLI 中包装一些现有的 C++ 库通常很容
好的,我们有了这个庞大的裸机 php 项目,我们想慢慢将其转换为 Symfony3 这是一个不断变化和更新的项目,因此我们需要它是透明的,以确保不会干扰使用它的人。他们根本不应该注意到差异。 所以我们
我们有一个中型 Java 应用程序需要一些重构。 我们正在考虑迁移到 JRuby on Rails。主要是因为 Ruby on Rails 提供的生产力以及许多将重新实现 Web 逻辑的现有插件。 但
我的问题是关于经典 ASP,而不是 ASP.Net。我在这里询问专家,因为搜索引擎总是告诉我 ASP.Net 答案。我的困惑是, 如何在经典 ASP 代码中或通过配置设置 session 过期时间?
在十多年没有用 C++ 编程之后,我正在尝试向遗留的 C++ Win32 DLL 添加正确的错误报告。 这有力地提醒了我们在 C/C++ 中处理空终止字符串的令人难以置信的单调乏味——更不用说潜在的缓
我必须获得一些在 Windows 10 下运行的遗留 (XP) MFC 代码。它在 Windows 7 下运行良好。我没有尝试过任何其他版本。 想法是内存中有一个缓冲区,其中包含 RGB 格式的图像像
require('url').parse('someurl.com/page') 已仅在文档中被弃用,我们严格的 linter 对此感到不满...我尝试在我们的代码中将其替换为互联网建议的 new U
我是一名优秀的程序员,十分优秀!