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 »
How to use MSDE(SQL Server) as GBPVR Database

 
  • 0 Vote(s) - 0 Average
How to use MSDE(SQL Server) as GBPVR Database
KingArgyle
Offline

Posting Freak

Posts: 1,271
Threads: 95
Joined: Nov 2004
#41
2004-12-22, 04:44 PM
Yep, I tried that as well.

Also, tried, creating a View that just had getdate() in the select statement. But SQL Server doesn't allow Scalar functions not to have a parameter, all scalar functions must have a parameter.

Only way to get around this is to handle it outside the application.
KingArgyle
Offline

Posting Freak

Posts: 1,271
Threads: 95
Joined: Nov 2004
#42
2004-12-22, 05:08 PM
Actually, it might work doing something like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
CREATE VIEW CurTimeView
AS
SELECT RAND() as curTime
GO

CREATE FUNCTION dbo.now() RETURNS datetime
AS
BEGIN
RETURN (SELECT curTime from CurTimeView)
END
GO
[/QUOTE]

I tried something similar last night but SQL Server kept complaining that I didn't have a parameter for the scalar function. I found syntax examples on the web for these formats, and all are supposed to work on SQL Server 2000. Unfortunately I don't have MSDE or Enterprise Manager to test these out at work.

Here is an article that shows how to do this as well:
http://www.extremeexperts.com/sql/articl...tions.aspx



cginzel
Offline

Member

Posts: 192
Threads: 22
Joined: Dec 2004
#43
2004-12-22, 05:33 PM
[b Wrote:Quote[/b] ]Easiest way to do this, is to just run the Import Data wizard, and it'll set it up for you.

I suspect a Identity column is not matching up, and causing the storechannel to fail.
Okay, I used the import wizard and GBPVR worked great except for the Search Guide which apparently also uses the Now() function so it fails to show anything when selecting a letter.

Then I went to the configuration and tried to update the EPG.  This time I got a different error regarding a null oid on the PROGRAMME table, so made that column an identity and did the refresh again and it completed without an error message, however the log still has the follwoing line:

12/22/2004 11:23:41 AM.468 WARNING [2134] Unexpected error removing old shows from EPG: Line 1: Incorrect syntax near 'p'.

So something is not completely correct...

The import translated the text fields into nvarchar and they seem to be working.  Are you sure these need to be converted to a simple varchar?

Also, should I make oid an identity in all of the tables?

-Charles
[SIZE="1"]NextPVR v2.3.4 on XP Home SP2
Rig: Dual Core P4 2.8GHz, 3GB Ram + 230GB HD
Media: WinTV PVR-150/MCE (2) + Media MVP 1000 (1) vD3A
Tools/Plug-ins: Weather, ComSkip, NEWA[/SIZE]
cginzel
Offline

Member

Posts: 192
Threads: 22
Joined: Dec 2004
#44
2004-12-22, 05:54 PM
Okay, I ran the following DDL:

CREATE VIEW CurrentDate AS SELECT Date = GETDATE()
GO
CREATE FUNCTION now () RETURNS DATETIME AS
BEGIN
DECLARE @myDateTime DATETIME
SELECT @myDateTime = Date FROM CurrentDate
RETURN (@myDateTime)
END
GO
GRANT EXECUTE ON now TO gbpvr
GO

But I still see the following in the log:

12/22/2004 11:44:24 AM.640 ERROR [75] Failure in ChannelFactory::getCurrentProgrammeList(): 'now' is not a recognized function name.

The reason is the function name is really dbo.now... In Oracle I would just define a synonym and be done with it!

Isn't there a way to alias the gbpvr userid as dbo in SQL Server?

-Charles
[SIZE="1"]NextPVR v2.3.4 on XP Home SP2
Rig: Dual Core P4 2.8GHz, 3GB Ram + 230GB HD
Media: WinTV PVR-150/MCE (2) + Media MVP 1000 (1) vD3A
Tools/Plug-ins: Weather, ComSkip, NEWA[/SIZE]
KingArgyle
Offline

Posting Freak

Posts: 1,271
Threads: 95
Joined: Nov 2004
#45
2004-12-22, 05:55 PM
You can probably get away with nvarchar fields.

What you'll notice on the last error message, is that it is trying to remove old programs from the program table. I suspect the code that needs to be executed is something like:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
SQL Server:
DELETE FROM PROGRAMME WHERE end_time < getdate()

Access:
DELETE FROM PROGRAMME WHERE end_time < now()

[/QUOTE]

If that code doesn't execute correctly, you'll just end with up old guide information in the database.

To clean up the guide, you could execute an OSQL command line command in the PostEPGUpdate.bat file, and have it clean up the guide after it has finished.

As for the Search on the Guide, have you tried Jorm's Fast Find plugin? I don't know exactly how he is searching that information. I primarily use the Web Admin for scheduling and searching for recordings, so I don't use the Guide built into the main GBPVR application.

If you can get the NOW() udf function implemented, that might take care of your guide problems.



cginzel
Offline

Member

Posts: 192
Threads: 22
Joined: Dec 2004
#46
2004-12-22, 06:15 PM
According to this post:

http://groups-beta.google.com/group....0f492c2

Scaler UDFs require the database owner prefix...

And apparently even if you are logged in as sa!

Ultimately, maybe sub can find a way to make his queries more db egnostic... or maybe getdate() can be defined within Access... so getdate() can be used thoughout.

-Charles



[SIZE="1"]NextPVR v2.3.4 on XP Home SP2
Rig: Dual Core P4 2.8GHz, 3GB Ram + 230GB HD
Media: WinTV PVR-150/MCE (2) + Media MVP 1000 (1) vD3A
Tools/Plug-ins: Weather, ComSkip, NEWA[/SIZE]
KingArgyle
Offline

Posting Freak

Posts: 1,271
Threads: 95
Joined: Nov 2004
#47
2004-12-22, 06:16 PM
[b Wrote:Quote[/b] ]

12/22/2004 11:44:24 AM.640 ERROR [75] Failure in ChannelFactory::getCurrentProgrammeList(): 'now' is not a recognized function name.

The reason is the function name is really dbo.now... In Oracle I would just define a synonym and be done with it!

Might be able to specify the owner of the function, doing

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
create function gbpvr.now()
[/QUOTE]

You can also just try changing the owner of the function with the Enterprise Manager.

This article shows that you can execute a UDF without the owner qualification on it.
http://www.devarticles.com/c....3



KingArgyle
Offline

Posting Freak

Posts: 1,271
Threads: 95
Joined: Nov 2004
#48
2004-12-22, 06:23 PM
Yeah, you are correct, I was looking at a table function.

I'm going to check with Jorm and see if he is using the now() function in his fast find plugin.
cginzel
Offline

Member

Posts: 192
Threads: 22
Joined: Dec 2004
#49
2004-12-22, 06:27 PM
[b Wrote:Quote[/b] ]Yeah, you are correct, I was looking at a table function.
Yup... I tried defining the function as gbpvr.now(), but then all references must be done like:

select gbpvr.now()

so that's still a non-starter...

-Charles



[SIZE="1"]NextPVR v2.3.4 on XP Home SP2
Rig: Dual Core P4 2.8GHz, 3GB Ram + 230GB HD
Media: WinTV PVR-150/MCE (2) + Media MVP 1000 (1) vD3A
Tools/Plug-ins: Weather, ComSkip, NEWA[/SIZE]
KingArgyle
Offline

Posting Freak

Posts: 1,271
Threads: 95
Joined: Nov 2004
#50
2004-12-22, 06:45 PM
A couple of solutions come to mind, both require reworking existing code though:

Create a SQLFunctionHelper class file, that contains the following definitions:

SQLFunctionHelper.Today
SQLFunctionHelper.Now

When it is initialized, the Provider string for connecting to the database is passed to it. This string is queried, and if the SQL Server provider is specified:

SQLFunctionHelper.Today = &quot;getdate()&quot;
SQLFunctionHelper.Now = &quot;getdate()&quot;

For Access:
SQLFunctionHelper.Today = &quot;now()&quot;
SQLFunctionHelper.Now = &quot;now()&quot;

And when the inline SQL is created for accessing the data, something like this can be coded:

string sqlString = &quot;DELETE FROM PROGRAMME WHERE end_time &lt; &quot; + SQLFunctionHelper.Now

Which would generate:

SQL Server:
DELETE FROM PROGRAMME WHERE end_time &lt; getDate()

Access:
DELETE FROM PRPGRAMME WHERE end_time &lt; now()

Thus making the same code function on either Access or SQL Server. A simple modificaton could be made to the SQLFunctionHelper class to support other Databases as well.

Really, the best solution in the long run is moving the items to a Access Stored Procedure. I like stored procedures for several reasons. Seperates the Data from the Business Logic, and the Presentation Logic. Plus allows for easier support of multiple databases.

If the SQL was stored in a stored procedure it would be a small matter of porting it to SQL Server, and creating the same stored procedure there as exists in Access. Plus on Enterprise level databases these are pre-compiled so the access paths are already calculated, and data is returned quicker.



« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (15): « Previous 1 … 3 4 5 6 7 … 15 Next »
Jump to page 


Possibly Related Threads…
Thread Author Replies Views Last Post
  Determine Server Tuner/Recorder Status from Console App 27InchSony 13 8,293 2016-12-21, 05:03 AM
Last Post: mvallevand
  Looking for C# UPnP Media Server code bgowland 5 7,647 2016-12-16, 08:25 PM
Last Post: mvallevand
  TitanTv Remote Schedule For GBPVR UncleJohnsBand 51 33,728 2015-08-20, 05:11 PM
Last Post: sub
  Delete recordings from database but not from disk? spinnaker 8 3,826 2013-10-26, 10:51 PM
Last Post: spinnaker
  trying to fake npvr database for unit tests reven 3 2,266 2013-05-20, 08:53 AM
Last Post: reven
  Roku & GBPVR pvruser 16 11,523 2011-10-16, 08:31 PM
Last Post: pvruser
  (Yet Another) Rename Helper script for GBPVR & NPVR pvruser 2 2,733 2011-07-22, 01:27 AM
Last Post: pvruser
  Merged database queries mvallevand 4 2,091 2011-06-26, 09:56 PM
Last Post: mvallevand
  NPVR database questions mvallevand 25 9,875 2011-01-06, 12:58 AM
Last Post: jksmurf
  NPVR database - why so stringy with the fields?? :0) carpeVideo 4 2,039 2010-09-21, 01:48 AM
Last Post: sub

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

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

Linear Mode
Threaded Mode