NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 54 55 56 57 58 … 93 Next »
Problems with Querries in SQL Lite

 
  • 0 Vote(s) - 0 Average
Problems with Querries in SQL Lite
Jeff
Offline

Posting Freak

Posts: 1,933
Threads: 69
Joined: Oct 2004
#1
2006-06-14, 12:31 AM
I am hoping there is an SQL expert out there that can help me. I have a plug-in that runs SQL querries against the programme table to look up EPG information. I am using trying to use the regular expression syntax to allow remote control input to do text string look ups. Everything works finr when using Access but the querries don't work when using SQL Lite.

I am using something like this for the match text

WHERE (name LIKE '[8ÙÚÛÜtuvùúûü]%' OR name LIKE '% [8ÙÚÛÜtuvùúûü]%')

I would expect it to match name fields that, for example, have a word that start with t, u, or v. In Access it does; is SQL lite it does not.

Any ideas?

Thanks

Jeff
David
Offline

Senior Member

Posts: 435
Threads: 18
Joined: Oct 2005
#2
2006-06-14, 01:26 AM
Jeff Wrote:I am hoping there is an SQL expert out there that can help me. I have a plug-in that runs SQL querries against the programme table to look up EPG information. I am using trying to use the regular expression syntax to allow remote control input to do text string look ups. Everything works finr when using Access but the querries don't work when using SQL Lite.

I am using something like this for the match text

WHERE (name LIKE '[8ÙÚÛÜtuvùúûü]%' OR name LIKE '% [8ÙÚÛÜtuvùúûü]%')

I would expect it to match name fields that, for example, have a word that start with t, u, or v. In Access it does; is SQL lite it does not.

I do a lot of SQL, but I am not familiar with SQLite. The following web page seems to indicate that regex is not supported in SQLite.
http://refdb.sourceforge.net/manual/sect...SSIONS-SQL
David

PVR PC: Win2K3, Athlon x2 64 4600+, 1280MB Ram, 40+400 GB HD's, Gigabyte Network
PVR-250, ATSC-110 digital x2, GBPVR v1.3.7 w/SQLite DB
Extras: Addepisode 41, Comskip 79.46, EWA 76, Zaptools

DSM-520 (D-Link Media Lounge) FW 1.04 using TVersity Media Server 0.9.11.4
DSM-320 (D-Link Media Lounge) FW 1.09
MediaMVP

More specs
alibert
Offline

Posting Freak

Posts: 974
Threads: 83
Joined: Apr 2005
#3
2006-06-14, 05:47 AM
Hi,

Jeff Wrote:I am using something like this for the match text

WHERE (name LIKE '[8ÙÚÛÜtuvùúûü]%' OR name LIKE '% [8ÙÚÛÜtuvùúûü]%')

I would expect it to match name fields that, for example, have a word that start with t, u, or v. In Access it does; is SQL lite it does not.

try the following:

Code:
select * from programme where name regexp '\b[tuv]';

But...
"In SQLite it does; in Access it does not."


-alibert
Spartan
Offline

Senior Member

Posts: 457
Threads: 28
Joined: Mar 2005
#4
2006-06-14, 01:27 PM
Jeff Wrote:I am hoping there is an SQL expert out there that can help me. I have a plug-in that runs SQL querries against the programme table to look up EPG information. I am using trying to use the regular expression syntax to allow remote control input to do text string look ups. Everything works finr when using Access but the querries don't work when using SQL Lite.

I am using something like this for the match text

WHERE (name LIKE '[8ÙÚÛÜtuvùúûü]%' OR name LIKE '% [8ÙÚÛÜtuvùúûü]%')

I would expect it to match name fields that, for example, have a word that start with t, u, or v. In Access it does; is SQL lite it does not.

Any ideas?

Thanks

Jeff


I just installed it on my system and it works great with SQL Server 2005. Your SQL cannot be that far off! Cool

Incidentally, I never knew you could do regex expressions in a where clause. I'll have to tuck that one away in the ol' memory bank.
GBPVR v1.0.16 | Comskip | SportsScores | Weather | I-XmlTV

Server: Tyan Thunder h1000E | 2 x Opteron 2210 | 2GB PC2-5300 DDR2 ECC
LSI MegaRAID 300-8X SATA RAID
1x 73GB SCSI @ 10K RPM (OS)
3x 500GB SATA @ 7.2K RPM (RAID 5) (4 Partitions: Docs, Still Pics, Home Movies, Music)
2x 160GB IDE @ 7.2K RPM (RAID 0) (Recordings)
Hauppauge HVR-1600

Client: Gigabyte GA-MA69GM-S2H | Athlon x2 5000+ BE | 2GB PC-6400 DDR2
1x 320GB SATA @ 7.2K RPM
Antec NSX2480 Case
MCE Remote
Jeff
Offline

Posting Freak

Posts: 1,933
Threads: 69
Joined: Oct 2004
#5
2006-06-14, 03:09 PM
Thanks. That works for finding words that start with the given characters, but not for the first word. That is, it will match "Hi There" but not "There Hi"

I tried

select * from programme where name regexp '^[tuv]';

but that doesn't return anything. I assuem the problem is that the ^ is being treated as a not rather than a start of line indicator, but I am not sure how to specify what I want.

Jeff
alibert
Offline

Posting Freak

Posts: 974
Threads: 83
Joined: Apr 2005
#6
2006-06-14, 03:47 PM
Hi,

/b also matches the first word of a string. More information on this meta character can be found here, for example.

So, the query posted above should also return programmes whose first character of the title is 't', 'u' or 'v'.

-alibert
Jeff
Offline

Posting Freak

Posts: 1,933
Threads: 69
Joined: Oct 2004
#7
2006-06-14, 03:55 PM
I have been testing the querries with SQLLite Spy and for some reason it didn't seem to be doing that but I will look again.

What if, however, I only want to match a word that is at the start of a line and not match words that appear later?

Jeff
alibert
Offline

Posting Freak

Posts: 974
Threads: 83
Joined: Apr 2005
#8
2006-06-14, 04:20 PM
Hi,

Jeff Wrote:What if, however, I only want to match a word that is at the start of a line and not match words that appear later?

start of string:
Code:
select * from programme where name regexp '\A[tuv]';

start of line:
Code:
select * from programme where name regexp '^[tuv]';

By the way those expressions will only match the lowercase characters 't', 'u' and 'v'.

-alibert
Jeff
Offline

Posting Freak

Posts: 1,933
Threads: 69
Joined: Oct 2004
#9
2006-06-14, 05:16 PM
Thanks. I had tried both the \A and the ^ but I forgot that regular expressions are case sensitive (where as SQL LIKE qurerries are not).

Jeff
Jeff
Offline

Posting Freak

Posts: 1,933
Threads: 69
Joined: Oct 2004
#10
2006-06-15, 04:18 PM
Next problem. The querry I am using works fine in SQLiteSpy, but when I put it into my plug-in and execute it in code I get an error.

Here is my querry

Code:
SELECT name, sub_title, description, start_time, end_time, channel_oid, unique_identifier, oid FROM PROGRAMME WHERE name REGEXP '\b[8TUVÙÚÛÜtuvùúûü]' ORDER BY name

Here is the code

Code:
DbCommand myCommand = dbProviderFactory.CreateCommand();
                myCommand.CommandText = mySelectQuery;
                myCommand.Connection = GBPVRDBConnection;
                DbDataReader myReader = myCommand.ExecuteReader();

And here is the error

Code:
System.Data.SQLite.SQLiteException: SQLite error
no such function: REGEXP
   at System.Data.SQLite.SQLite3.Prepare(String strSql, SQLiteStatement previous, String& strRemain)
   at System.Data.SQLite.SQLiteCommand.BuildNextCommand()
   at System.Data.SQLite.SQLiteCommand.GetStatement(Int32 index)
   at System.Data.SQLite.SQLiteDataReader.NextResult()
   at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
   at System.Data.SQLite.SQLiteCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.ExecuteReader()
   at ShowSearchPlugin.ShowSearchTask.GetShowList(

Any ideas why it thinks there is no REGEXP function?

Jeff
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (2): 1 2 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problems with Windows UWP App spitefulgod 4 3,762 2016-12-15, 08:35 PM
Last Post: spitefulgod
  Key press problems imilne 13 4,801 2013-01-02, 04:05 PM
Last Post: imilne
  Plugin problems with started from the command line mvallevand 11 4,930 2012-08-12, 07:56 PM
Last Post: sub
  problems with screen updates from ActivateItem InVermont 2 1,694 2009-03-12, 04:45 PM
Last Post: InVermont
  XMLSerializer Problems with Plugins ralphy 6 4,453 2008-02-16, 02:54 PM
Last Post: whurlston
  Problems retrieving providers using MceEpg2xmlTv kiekar 4 1,780 2007-10-13, 04:08 PM
Last Post: kiekar
  Form KeyDown Event Problems HydroChronic 1 1,481 2007-07-17, 02:09 PM
Last Post: HydroChronic
  Problems with THEATRIX 550 HW MPEG2 encoder bitrates. tmrt 0 1,215 2007-05-28, 01:36 PM
Last Post: tmrt
  Problems Connecting up a Radio Graph timh 6 2,502 2006-11-11, 08:10 PM
Last Post: timh
  VB6 and SQL-lite? zehd 5 2,840 2006-07-10, 02:38 AM
Last Post: UncleJohnsBand

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode