ODBC:什么时候是创建数据库的最佳时间?

发布于 2024-09-02 14:15:04 字数 917 浏览 0 评论 0原文

我有一个 Windows 程序,可以生成稍后填写的 PGP 表格。

这些 PHP 表单将填充数据库。它看起来很像MySql,但我不能确定,所以我们称它为ODBC。

是的,它必须是一个 Windows 程序。

还会有查询数据库的 PHP 表单 - 检查它包含哪些表和字段,然后生成可用于搜索数据库的表单(例如,它找到一个包含“employee_name”等字段的表,并生成一个表单,让我们


将其称为设计时和运行时。

在设计时,一些经理或 IT 人员或类似人员可以定义数据库的性质,在运行时 1) 工作人员每天填写表格,2)管理人员可以提取报告。

这是我的问题:鉴于数据库是在“设计时”定义的(并在运行时填充),那么最好在哪里以及如何执行此操作?

1 我可以使用 Windows 程序中的 ODBC 接口,但我很难找到与 Delphi 一起使用的好东西。像 ADO 和 firebird 这样的东西往往期望您已经拥有一个数据库并允许您操作它,但我找不到如何创建数据库和一些表的代码示例,所以...
2 我可以在 Windows 程序中使用 Delphi 中的 DOS 命令。我刚刚尝试并得到了对 MySql --version 的回复,但不确定 MySql 等是否更具交互性。也就是说,我可以使用脚本文件或非常长的 stacked 命令(用分号和返回分隔)吗?例如'创建数据库db;创建表 t1;'
3)由于使用数据库的最佳方式似乎是 PHP,也许我的 Windows 程序可以输出一个 PHP 页面,当在浏览器中运行时,该页面会创建数据库。


我已尽力使这一切变得简单,但请随时提出问题。可能有几种有效的方法,但就易于实施或维护而言,可能有一种“更好”的解决方案。


更好的暂存选项 3. 如果用户稍后想要返回并让 Windows 程序更改输入形式怎么办?它也需要更新数据库。

I have a windows program which generates PGP forms which will be filled in later.

Those PHP forms will populate a database. It looks very much like MySql, but I can't be certain, so let's call it ODBC.

And, yes, it does have to be a windows program.

There will also be PHP forms which query the database - examine which tables and fields it contains and then generates forms which can be used to search the database (e.g, it finds a table with fields "employee_name", etc and generates a form which lets you search based on employee name.


Let's call that design time and run time.

At design time, some manager or IT guy or similar gets to define the nature of the database and at runtime 1) a worker fills in the form daily and 2) management can extract reports.

Here's my question: given that the database is defined at "design time" (and populated at run time), where and how is best to do so?

1 I could use an ODBC interface from the windows program, but I am having difficulty finding something good to work with Delphi. Things like ADO and firebird tend to expect you to already have a database and allow you to manipulate it, but I can find no code example of how to create a database and some tables, so ...
2 I could used DOS commands from Delphi in my windows program. I just tried and got a response to MySql --version, but am not sure if MySql etc are more interactive. That is, can I use a script file or a very long stacked command with semicolons and returns separating? e.g 'CREATE DATABASE db; CREATE TABLE t1;'
3) Since the best way to work with databases seems to be PHP, perhaps my windows program could spit out a PHP page which would, when run in a browser, create the database.


I have tried to make this as uncomplicated as I can, but please feel free to ask questions. It may be that there are several valid ways, but there is probably one 'better' solution in terms of ease of implementation or maintenance.


Better scratch option 3. What if the user later wants to come back and have the windows program change the input form? It needs to update the database too.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谁与争疯 2024-09-09 14:15:04

创建数据库通常是数据库管理员的任务。除非它是本地数据库,也许是嵌入式数据库,否则用户需要知道在远程服务器上的位置以及如何创建数据库,而她对此一无所知。数据库文件存放在哪里?哪些磁盘可用?并且可能还有更多的参数需要设置(内存缓冲区大小等)、要创建的用户等等。而且您还需要非常高的权限才能创建数据库,而不是授予普通用户或应用程序的权限。
因此,通常您要求数据库管理员创建数据库/模式,他会给您连接所需的凭据,然后您的应用程序(或其设置)将创建并初始化所需的对象(表等)。创建表(和其他对象)通常就像运行“CREATE TABLE....”语句一样简单。请记住 SQL 只接受一个命令,如果您需要运行多个命令,您必须自己一个接一个地发送它们,尽管有 Delphi 组件能够将脚本拆分为命令并一个接一个地运行。

Creating a database is usually a database administrator task. Unless it is a local database, maybe an embedded one, the user would need to know where and how create the database on the remote server, and she can have no clue about it. Where to store the database files? Which disks are available? And there could be many more parameters to set (memoery buffers size, etc.), users to be created and so on. And also you need very elevate privileges to be able to create a database, not something you give to average users or applications.
Thereby usually you ask the database administrator to create your database/schema, he will give you the credentials you need to connect, and then your application (or its setup) will create and initialize the needed objects (tables, etc.). Creating table (and other object) is usually as simple as running "CREATE TABLE...." statements. Just remember SQL takes one command only, if you need to run several commands you have to send them one after another yourself, although there are Delphi components which are able to split a script in commands and run one after another.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文