Re: [sqlite] Suggest some Tools for Sqlite

2011-08-20 Thread Paul Linehan
2011/8/18 Madhankumar Rajaram :

> I hope there should be some good Free or Licence Tools for using Sqlite.
> For ex : Toad for Oracle.


Hmmm Toad for SQLite - there's a thought.  ;)


> so, Kindly suggest the best Free / Licence Tool for using Sqlite
> Thanks


Try the Firefox extension - I think it's great!


Paul...


> Madhan Kumar R


-- 


lineh...@tcd.ie

Mob: 00 353 86 864 5772
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQL query help

2011-08-20 Thread Paul Sanderson
Hmm thanks Roger

Table could have a few million rows, i'll have a play and see what the
run time is. The relevant column is indexed

On 20 August 2011 17:14, Roger Andersson  wrote:
>  On 08/20/11 05:42 PM, Paul Sanderson wrote:
>> Hi all
>>
>> I am trying to create a query that works to craete a subset of a table
>> based on duplicate items
>>
>> Examples work best so consider the contrived table with the following rows
>> 10 socata
>> 7 socata
>> 13 cessna
>> 2 piper
>> 7 piper
>> 55 piper
>> 1 diamond
>>
>> I want to see the subset that is
>> 10 socata
>> 7 socata
>> 2 piper
>> 7 piper
>> 55 piper
>>
>> i.e. all rows that have a matching value in any other row in the second 
>> column
>>
>> any ideas?
>> ___
> Might be more efficient queries if there is a LOT of records but this
> seems to do the trick.
>  create table tbl (id,text);
>  insert into tbl values (10, 'socata');
>  insert into tbl values (7, 'socata');
>  insert into tbl values (13, 'cessna');
>  insert into tbl values (2, 'piper');
>  insert into tbl values (7, 'piper');
>  insert into tbl values (55,'piper');
>  insert into tbl values (1, 'diamond');
>  select * from tbl where text in (select text from tbl group by text
> having count(*) > 1);
> 10|socata
> 7|socata
> 2|piper
> 7|piper
> 55|piper
>
> Cheers Roger
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
Paul Sanderson
Sanderson Forensics
+44 (0)1326 572786
www.sandersonforensics.com
http://www.twitter.com/sandersonforens
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQL query help

2011-08-20 Thread Roger Andersson
  On 08/20/11 05:42 PM, Paul Sanderson wrote:
> Hi all
>
> I am trying to create a query that works to craete a subset of a table
> based on duplicate items
>
> Examples work best so consider the contrived table with the following rows
> 10 socata
> 7 socata
> 13 cessna
> 2 piper
> 7 piper
> 55 piper
> 1 diamond
>
> I want to see the subset that is
> 10 socata
> 7 socata
> 2 piper
> 7 piper
> 55 piper
>
> i.e. all rows that have a matching value in any other row in the second column
>
> any ideas?
> ___
Might be more efficient queries if there is a LOT of records but this 
seems to do the trick.
  create table tbl (id,text);
  insert into tbl values (10, 'socata');
  insert into tbl values (7, 'socata');
  insert into tbl values (13, 'cessna');
  insert into tbl values (2, 'piper');
  insert into tbl values (7, 'piper');
  insert into tbl values (55,'piper');
  insert into tbl values (1, 'diamond');
  select * from tbl where text in (select text from tbl group by text 
having count(*) > 1);
10|socata
7|socata
2|piper
7|piper
55|piper

Cheers Roger
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] SQL query help

2011-08-20 Thread Paul Sanderson
Hi all

I am trying to create a query that works to craete a subset of a table
based on duplicate items

Examples work best so consider the contrived table with the following rows
10 socata
7 socata
13 cessna
2 piper
7 piper
55 piper
1 diamond

I want to see the subset that is
10 socata
7 socata
2 piper
7 piper
55 piper

i.e. all rows that have a matching value in any other row in the second column

any ideas?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite + unicode

2011-08-20 Thread Jean-Christophe Deschamps

>I try this function. Do you have Visual Studio. i show you my example.
>
>NOCaut wrote:
> >
> >
> > char * unicode_to_1251(wchar_t *unicode_string)

Why are you converting Unicode to 1251?  This is a lossy conversion in 
the general case.

Work with Unicode strings end-to-end, using the UTF encoding of your 
choice.  Since you're using Windows, UTF16-LE is the natural choice but 
you can still use UTF-8 as well of course.

Note that this is for SQLite API interface only.  Internally, SQLite 
will store text under the UTF setting which was used when creating the 
DB.  By default, SQLite will create an UTF-8 DB but you can force 
UTF-16 _storage_ at creation time.

After that you can use either the UTF-8 API functions or the UTF-16 
versions and SQLite will perform the necessary conversion internally 
for you.

At your application level, you probably want to use UTF16-LE (Windows) 
but you may have to convert external ANSI data sources (if any) like 
.CSV files or such  into Unicode for DB storage.

--
j...@antichoc.net  

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite + unicode

2011-08-20 Thread NOCaut

this is my example spellings on the VS2008
http://www.4shared.com/file/RDzSVPZq/SQLite_example.html

-- 
View this message in context: 
http://old.nabble.com/SQLite-%2B-unicode-tp32296232p32301433.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite + unicode

2011-08-20 Thread NOCaut

I try this function. Do you have Visual Studio. i show you my example.

NOCaut wrote:
> 
> 
> char * unicode_to_1251(wchar_t *unicode_string)
> {
>   int err;
>   char * res;
>   int res_len = WideCharToMultiByte(
>   1251,   // Code page
>   0,  // Default replacement 
> of illegal chars
>   unicode_string, // Multibyte characters string
>   -1, // Number of unicode 
> chars is not known
>   NULL,   // No buffer yet, allocate it 
> later
>   0,  // No buffer
>   NULL,   // Use system default
>   NULL// We are not interested 
> whether the default char was used
>   );
>   if (res_len == 0) 
>   {
>   printf("Failed to obtain required cp1251 string length\n");
>   return NULL;
>   }
>   res = (char*)calloc(sizeof(char), res_len);
>   if (res == NULL) 
>   {
>   printf("Failed to allocate cp1251 string\n");
>   return NULL;
>   }
>   err = WideCharToMultiByte(
>   1251,   // Code page
>   0,  // Default replacement 
> of illegal chars
>   unicode_string, // Multibyte characters string
>   -1, // Number of unicode 
> chars is not known
>   res,// Output buffer
>   res_len,// buffer size
>   NULL,   // Use system default
>   NULL// We are not interested 
> whether the default char was used
>   );
>   if (err == 0)
>   {
>   printf("Failed to convert from unicode\n");
>   free(res);
>   return NULL;
>   }
>   return res;
> }
> 

-- 
View this message in context: 
http://old.nabble.com/SQLite-%2B-unicode-tp32296232p32301058.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite + unicode

2011-08-20 Thread Kees Nuyt
On Sat, 20 Aug 2011 01:45:42 -0700 (PDT), NOCaut 
wrote:

> For "" and '' i know thanks, and why you write ?
> i want write arabic symbul 

Apparently your utf-8 Arabic characters were dropped and replaced
by ?, probably by my mail reader. My apologies.

Replace the '?' by the utf-8 you originally used in your
program.
-- 
  (  Kees Nuyt
  )
c[_]
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite + unicode

2011-08-20 Thread NOCaut

For "" and '' i know thanks, and why you write ? i want write arabic
symbul مثالمثالمثالمثال
-- 
View this message in context: 
http://old.nabble.com/SQLite-%2B-unicode-tp32296232p32300446.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] type of a value bound by sqlite3_bind_blob ()?

2011-08-20 Thread Ivan Shmakov
> Ivan Shmakov writes:
> Roger Binns writes:

[…]

 >> Consequently if you had a trigger pulling a stunt like this, your
 >> code could try to insert a blob and silently (wrongly) end up with a
 >> string.  SQLite won't even complain if the blob isn't a valid text
 >> encoding producing an invalid string.

 > I don't have any triggers (at least, it wasn't my intent to add
 > them.)  My code is roughly as shown below.

 > And I don't seem to understand where's the problem.

Silly mistake on my part, as I've just found.

Namely, I've had /two/ functions to alter the table in question.
One of them INSERT's the tuple, and uses sqlite3_bind_blob ().
The other, that UPDATE's the tuple, however, uses
sqlite3_bind_text ().

Before I saw that there's sound support for blobs in the current
SQLite, I've planned to use Base64 for these fields; after, I've
changed one of the functions, but not the other.

And yes, code duplication is clearly a bad thing.

Now that the discrepancy is fixed, the problem is gone.

Thanks.

[…]

-- 
FSF associate member #7257  Coming soon: Software Freedom Day
http://mail.sf-day.org/lists/listinfo/ planning-ru (ru), sfd-discuss (en)

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users