Problem with SQLITE

Put your problem here if it does not fit any of the other categories.

Problem with SQLITE

Postby abhilash » Mon Feb 25, 2008 8:46 am

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. myDB.execSQL("CREATE TABLE IF NOT EXISTS "
  2.  
  3. + MY_DATABASE_TABLE
  4.  
  5. + " (LastName VARCHAR, FirstName VARCHAR,"
  6.  
  7. + " Country VARCHAR, Age INT(3));");
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


hi i am getting errr yaar for the above statement ......... like Syntax error Vrchar.........
abhilash
Developer
Developer
 
Posts: 26
Joined: Fri Feb 22, 2008 11:21 am
Location: HYDERABAD

Top

Postby plusminus » Mon Feb 25, 2008 9:45 am

Hello abhilash,

that code was tested with sdk-version m3. Now we have m5.

Maybe you'll now have to write write the amount of possible chars in brackets: VARCHAR(50)
Imo: in mySQL the default-value is 255.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby living_sword » Mon Feb 25, 2008 5:20 pm

give the full error message. also, consider using TEXT instead of VARCHAR.
Last edited by living_sword on Tue Feb 26, 2008 1:01 pm, edited 1 time in total.
Image
living_sword
Junior Developer
Junior Developer
 
Posts: 23
Joined: Fri Nov 23, 2007 4:44 am

Postby res » Mon Feb 25, 2008 5:57 pm

According to the SQlite documentation specifying a length for VARCHAR is ignored.
res
Senior Developer
Senior Developer
 
Posts: 146
Joined: Tue Nov 20, 2007 8:14 pm
Location: United States

Postby plusminus » Mon Feb 25, 2008 6:35 pm

res wrote:According to the SQlite documentation specifying a length for VARCHAR is ignored.


:lol: ... what is the default-value then :?:

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby res » Tue Feb 26, 2008 3:42 am

plusminus wrote:
res wrote:According to the SQlite documentation specifying a length for VARCHAR is ignored.


:lol: ... what is the default-value then :?:

Regards,
plusminus


http://www.sqlite.org/faq.html#q9

9) What is the maximum size of a VARCHAR in SQLite?

SQLite does not enforce the length of a VARCHAR. You can declare a VARCHAR(10) and SQLite will be happy to let you put 500 characters in it. And it will keep all 500 characters intact - it never truncates.
res
Senior Developer
Senior Developer
 
Posts: 146
Joined: Tue Nov 20, 2007 8:14 pm
Location: United States

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 18 guests