Keval Langalia
Keval Langalia

Reputation: 1892

Storing "String" as "TEXT" instead of "VarChar" in SQLite - WP8

I'm storing my Data in local database using SQLite. I've string typed few variables to store. Now, when I store that string variables, it is being stored as "VARCHAR" (as in the picture below).

Picture 1

enter image description here

But I want to store those strings as "TEXT" type in SQLite. (as in the picture below)

Picture 2

enter image description here

The class I'm using to store db is as below:

public class abc
{
    [SQLite.AutoIncrement, SQLite.PrimaryKey]
    public int _id { get; set; }
    public string a { get; set; }
    public string b { get; set; }
    public string c { get; set; }
    public string d { get; set; }
    public string e { get; set; }
    public string f { get; set; }
    public string g { get; set; }
    public DateTime date { get; set; }

}

any help will be appreciated.

Upvotes: 6

Views: 15246

Answers (3)

user3813851
user3813851

Reputation: 21

As to my knowledge, Text type accepts UTF-8 and special chars symbols, etc. Its not the same with type Varchar.

Upvotes: 0

Vahid
Vahid

Reputation: 3442

Although there is no difference between Text and Varchar data types in SQLite, but if you want to change it the way you want, do this:

If you are using sqlite-net (SQLite.cs & SQLiteAsync.cs) in your WP8.0 app, then go to SQLite.cs class and find the SqlType method (about line 1863). Then you can see if (clrType == typeof(String)) statement. If you prefer Text data type then you can change varchar to text as you like.

Upvotes: 0

Parimal Raj
Parimal Raj

Reputation: 20575

varchar is TEXT in SQLite so u need not to worry!

Internally the data is always stored as TEXT, so even if you create table with VARCHAR(LEN), SQLite is going to follow the rules of TEXT data type

Upvotes: 9

Related Questions