String [] In SQLite query in Android causes SQL malformed

Source: Internet
Author: User
Tags sqlite query

String [] selectionargs = new string [] {weiboflag };
Cursor cursor = dB. rawquery ("select * from"
+ Sqlitehelper. table_name [1] + "where" + weibouserinfo. Flag
+ "=? ", Selectionargs );
What is the difference between generating a string [] In a parameter and generating a string outside the parameter?
It is not wrong to write the data only after it is generated and written outside. If it is written into the parameter, it will get = NULL.
I replace selectionargs with new string [] {weiboflag}
The obtained SQL statement is select * From Weibo where flag =? = NULL
Chongqing-IWT (81142686) 21:22:45

Is an array generated after SQL statements are generated?


I wrote another method and tested it myself. The result won't be like this. A C ++ user said it may be caused by no space allocation, maybe this encapsulation is a C ++ library, but as Java, it must be a bug.


The parameter is allocated only after the application is applied, but not when it is used.

When you apply for the parameter, the system has actually obtained your application name XXXX, but this is actually empty.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.