xcode 直接从 iPad 应用程序连接到 MySQL(而不是通过 PHP 等)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9151644/
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-14 23:13:09  来源:igfitidea点击:

Connect to MySQL directly from an iPad app (not via PHP, etc.)

mysqliosxcodeipadodbc

提问by JHollanti

Before anyone has a chance: Yes, i know it's a bad idea. Please, don't give me a lecture on how i should use a web service instead. Thanks.

在任何人有机会之前:是的,我知道这是个坏主意。请不要给我上一堂关于我应该如何使用网络服务的讲座。谢谢。

So, how could this be done?

那么,这怎么可能呢?

I found this bit http://www.karlkraft.com/index.php/2010/09/17/mysql-for-iphone-and-osx/and thought it might do the trick. I got a bunch of ARC error messages, cleaned those out and got this error at runtime:

我发现这个位http://www.karlkraft.com/index.php/2010/09/17/mysql-for-iphone-and-osx/并认为它可能会起作用。我收到了一堆 ARC 错误消息,将其清除并在运行时收到此错误:

Detected an attempt to call a symbol in system libraries that is not present on the iPhone: pthread_cond_init$UNIX2003 called from function my_thread_init in image oms.

检测到尝试调用 iPhone 上不存在的系统库中的符号:从图像 oms 中的函数 my_thread_init 调用的 pthread_cond_init$UNIX2003。

Do i need to use something like ODBC/C?

我需要使用像 ODBC/C 这样的东西吗?

I know that the solution might be a lengthy one, that's fine. Would be great if someone could at least point me in the right direction.

我知道解决方案可能很长,没关系。如果有人至少能指出我正确的方向,那就太好了。

EDIT:

编辑:

Since people are keen to know the reason for opting not to use a web service, here it is:

由于人们很想知道选择不使用网络服务的原因,这里是:

If you're creating an in-house app, the added security of a web service is next to nothing. Working directly with the DB means i need to maintain less code. Plus i don't need to create hacky PHP scripts to get things done.

如果您正在创建内部应用程序,则 Web 服务的附加安全性几乎为零。直接使用数据库意味着我需要维护更少的代码。另外,我不需要创建 hacky PHP 脚本来完成工作。

FINAL CONCLUSION:

定论:

I wanted to leave a message for people who're about to do the same thing: Don't :) Essentially your options are hacky server side scripts or Oracle proprietary mysql client you built yourself (and thus a hacky solution as well). Your choice but i'd strongly advice against it.

我想给即将做同样事情的人留言:不要 :) 本质上,您的选择是您自己构建的 hacky 服务器端脚本或 Oracle 专有 mysql 客户端(因此也是一个 hacky 解决方案)。您的选择,但我强烈建议您反对。

采纳答案by Peter M

This might be the sort of thing that you are looking for:

这可能是您正在寻找的类型:

mysql for iphone and osx

用于 iphone 和 osx 的 mysql

I found it on this iphonedevsdk thread access mysql remote database iphone

我在这个 iphonedevsdk thread access mysql remote database iphone上找到了它

Personally I would be only doing this if you really really wanted to.

就我个人而言,如果你真的想这样做,我只会这样做。

If you wanted a canned solution, I also found this: Flipper

如果你想要一个罐头解决方案,我还发现了这个:Flipper

Or to do it yourself: Build MySql client library for iPhone/iPad

或者自己动手:为 iPhone/iPad 构建 MySql 客户端库

Its not really that hard to find a number of solutions

找到许多解决方案并不难

回答by ciaranj

I needed the same thing (I understand your lecture-pain ;) ) so I wrote this: https://github.com/ciaranj/MySqueakQlit doesn't link to the mysql client libraries so no GPL issues, but it is a very minimal ... very 'fresh' i.e. untested implementation ... just my 2c.

我需要同样的东西(我理解你的演讲痛苦;))所以我写了这个:https: //github.com/ciaranj/MySqueakQl它没有链接到 mysql 客户端库,所以没有 GPL 问题,但它是一个非常小......非常“新鲜”,即未经测试的实现......只是我的2c。

回答by jeswang

I faced the same problem as you did. I searched and find this.

我遇到了和你一样的问题。我搜索并找到了这个。

In http://www.acapela-for-iphone.com/ios-4-2-gm-small-problem-with-simulator

http://www.acapela-for-iphone.com/ios-4-2-gm-small-problem-with-simulator

Jean-Michel Reghem Says: "It seems that Apple changes (again) something into the simulator (as in iOS 4.0)."

Jean-Michel Reghem 说:“Apple 似乎(再次)在模拟器中更改了一些东西(就像在 iOS 4.0 中一样)。”

Also some people in that page say that this problem didn't show up in device, you can try.

还有那个页面上的一些人说这个问题没有出现在设备上,你可以试试。

The author has updated his code, and it worked.

作者已经更新了他的代码,并且有效。

Here is the link: http://www.karlkraft.com/index.php/2011/06/07/mysql-for-iphone-and-osx-version-2-0/

这是链接:http: //www.karlkraft.com/index.php/2011/06/07/mysql-for-iphone-and-osx-version-2-0/