菜鸟教程小白 发表于 2022-12-12 09:33:00

android - 哪种方式更有效和更安全,后连接或直接连接到数据库?


                                            <p><p>我想在一个mysql数据库中插入很多数据,当然只有文本。</p>

<p>我目前正在通过帖子进行操作,例如 <code>insertUser.php?user=asd&pass=asdas&email=asdasd</code> 是否正常,它会给我一个回复,但现在我尝试 <code>upload</code> 大量数据,如 <code>insertData.php?xml=string&userid=2</code> 并且响应也很大,有时需要很长时间,因为它是用于手机的应用程序大多使用 <strong>3g (android & iOS)</strong>,那么哪个会更高效,仍然使用 <code>post connections</code> 还是 <code>direct mysql connection</code>?</p>

<p>谢谢。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>检查下面的答案</p>

<pre><code>xmlbody = (NSString *)CFURLCreateStringByAddingPercentEscapes(
                                                                        NULL,
                                                                            (CFStringRef)xmlbody,
                                                                            NULL,
                                                                            (CFStringRef)@&#34;!*&#39;\&#34;();:@&amp;=+$,/?%#[]% &#34;,
                                                                            kCFStringEncodingUTF8 );

NSMutableString *entirexmlbody=[init ];
;
;

NSLog(@&#34;posting XML Body after encoding--%@\n&#34;,xmlbody);

NSData *postData = ;
NSString *postLength = ];
NSMutableURLRequest *request = [[ init] autorelease];
];

;
;
;
;
NSURLConnection *conn=[[ initWithRequest:request delegate:self] autorelease];
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于android - 哪种方式更有效和更安全,后连接或直接连接到数据库?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/15338645/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/15338645/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: android - 哪种方式更有效和更安全,后连接或直接连接到数据库?