Mirage Source

Free ORPG making software.
It is currently Fri Apr 19, 2024 11:53 pm

All times are UTC




Post new topic Reply to topic  [ 16 posts ] 
Author Message
 Post subject: mysql errors
PostPosted: Thu Jan 31, 2008 7:41 pm 
Offline
Newbie

Joined: Thu Jan 31, 2008 7:43 am
Posts: 10
Every time I try to start the server after setting up the database I get an error:

Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record.

I get this if I use the sql_dump in the sticky or the sql dump that comes with the source.

The line that is highlighted if I use the dump from the sticky is

.FKey = CLng(RS("FKey"))

Any insight would be appreciated.

Thanks


Top
 Profile  
 
 Post subject: Re: mysql errors
PostPosted: Thu Jan 31, 2008 8:05 pm 
Offline
Pro
User avatar

Joined: Mon May 29, 2006 3:26 pm
Posts: 493
Location: São Paulo, Brasil
Google Talk: blackagesbr@gmail.com
This is how your subs need to look like:
Code:
Dim RS As ADODB.Recordset
        Set RS = New ADODB.Recordset
        RS.Open "QUERY", Conn_Client, adOpenStatic, adLockOptimistic ' now this are a lot of params, google them and you will know what them all do.
       
        RS.MoveFirst
        Variable = RS.Fields("FKey") ' blablabla
       
        RS.Close
    Set RS = Nothing

_________________
http://www.blackages.com.br
Image
Dave wrote:
GameBoy wrote:
www.FreeMoney.com
I admit I clicked. I immediately closed upon realizing there was, in fact, no free money.
Robin wrote:
I love you and your computer.Marry me.


Top
 Profile  
 
 Post subject: Re: mysql errors
PostPosted: Thu Jan 31, 2008 8:27 pm 
Offline
Newbie

Joined: Thu Jan 31, 2008 7:43 am
Posts: 10
Where should that declaration be though?


Top
 Profile  
 
 Post subject: Re: mysql errors
PostPosted: Fri Feb 01, 2008 6:13 pm 
Offline
Newbie

Joined: Thu Jan 31, 2008 7:43 am
Posts: 10
Hi again. I appreciated the fast response before.

I found that I had declared RS like you did, but it fails in this block of code:

Code:
For I = 1 To MAX_MAPS
    Call SetStatus("Loading Map " & I & "/" & MAX_MAPS)
    With Map(I)
        .FKey = CLng(RS("FKey"))
        .Name = Trim(CStr(RS("Name")))
        .Revision = CLng(RS("Revision"))
        .Moral = CByte(RS("Moral"))
        .Up = CInt(RS("Up"))
        .Down = CInt(RS("Down"))
        .Left = CInt(RS("mLeft"))
        .Right = CInt(RS("mRight"))
        .Music = CByte(RS("Music"))
        .BootMap = CInt(RS("BootMap"))
        .BootX = CByte(RS("BootX"))
        .BootY = CByte(RS("BootY"))
        .Shop = CByte(RS("Shop"))
        .Indoors = CByte(RS("Indoors"))
        'Load Tiles
        Tiles = Split(Trim(CStr(RS("Tiles"))), "|")
        Q = 0
        For X = 0 To MAX_MAPX
            For Y = 0 To MAX_MAPY
                TileSet() = Split(Tiles(Q), "-")
                .Tile(X, Y).Ground = CInt(TileSet(0))
                .Tile(X, Y).Mask = CInt(TileSet(1))
                .Tile(X, Y).Anim = CInt(TileSet(2))
                .Tile(X, Y).Fringe = CInt(TileSet(3))
                .Tile(X, Y).Type = CInt(TileSet(4))
                .Tile(X, Y).Data1 = CInt(TileSet(5))
                .Tile(X, Y).Data2 = CInt(TileSet(6))
                .Tile(X, Y).Data3 = CInt(TileSet(7))
                Q = Q + 1
            Next Y
        Next X
       
        'Load NPCs
        NPCs = Split(Trim(CStr(RS.Fields("NPCS"))), "-")
        For Q = LBound(NPCs) To UBound(NPCs)
            .Npc(Q + 1) = CByte(NPCs(Q))
        Next Q
       
    End With
    DoEvents
    If I <> MAX_MAPS Then
        RS.MoveNext
    End If
Next I


On the line .FKey = CLng(RS("FKey"))

I am not sure what variable you were suggesting to set it equal to...

Any further help would be much appreciated again.

Thanks,
swya


Top
 Profile  
 
 Post subject: Re: mysql errors
PostPosted: Fri Feb 01, 2008 7:10 pm 
Offline
Newbie

Joined: Thu Jan 31, 2008 7:43 am
Posts: 10
Upon more investigation, if I change
For I = 1 To MAX_MAPS
to
For I = 1 To 5
(because there are five maps in the database)
it doesn't crash.

I hope maybe this will shed some light as well.


Top
 Profile  
 
 Post subject: Re: mysql errors
PostPosted: Fri Feb 01, 2008 7:45 pm 
Offline
Pro
User avatar

Joined: Mon May 29, 2006 3:26 pm
Posts: 493
Location: São Paulo, Brasil
Google Talk: blackagesbr@gmail.com
You need to have the maps... I was assuming your database were full, I mean, it was full of data, but it appears to not be. Do that and it will work.

_________________
http://www.blackages.com.br
Image
Dave wrote:
GameBoy wrote:
www.FreeMoney.com
I admit I clicked. I immediately closed upon realizing there was, in fact, no free money.
Robin wrote:
I love you and your computer.Marry me.


Top
 Profile  
 
 Post subject: Re: mysql errors
PostPosted: Fri Feb 01, 2008 8:08 pm 
Offline
Newbie

Joined: Thu Jan 31, 2008 7:43 am
Posts: 10
I used the SQL dump that was available... Is there an alternate sql dump that will fill the database?

Thanks again, your speedy responses are very impressive in a support forum.

swya


Top
 Profile  
 
 Post subject: Re: mysql errors
PostPosted: Fri Feb 01, 2008 8:15 pm 
Offline
Pro
User avatar

Joined: Mon May 29, 2006 3:26 pm
Posts: 493
Location: São Paulo, Brasil
Google Talk: blackagesbr@gmail.com
I made my own xD
Work with this:
Code:
Public Function GetRecordCount(dbTable As String, Optional WH As String = "0") As Long
'Setup database stuff
Dim RS As ADODB.Recordset
Dim i As Long
Dim SQL As String
    Set RS = New ADODB.Recordset
    If WH = "0" Then
        SQL = "SELECT * FROM " & dbTable & ";"
    Else
        SQL = "SELECT * FROM " & dbTable & " WHERE " & WH & ";"
    End If
   
    RS.Open SQL, Conn_Client, adOpenStatic, adLockReadOnly
   
    RS.MoveFirst
    i = RS.RecordCount
   
    RS.Close
    Set RS = Nothing
    GetRecordCount = i
End Function

Public Sub CheckItems()
'Check to see if max items is how many items there are in the database.
Dim RecCount As Long
Dim i As Long
Dim OffSet As Long
Dim RS As ADODB.Recordset

RecCount = GetRecordCount("Items")
OffSet = MAX_ITEMS - RecCount
If OffSet = 0 Then Exit Sub
Set RS = New ADODB.Recordset
RS.Open "SELECT * FROM Items;", Conn_Client, adOpenStatic, adLockOptimistic

If RS.EOF = True Then Exit Sub

RS.MoveFirst
For i = MAX_ITEMS - OffSet + 1 To MAX_ITEMS
    RS.AddNew
   
    RS!FKey = i
    RS!Name = "   "
    RS!Descricao = "   "
    RS!Pic = 0
    RS!Type = 0
    RS!ClassReq = 0
    RS!Data1 = 0
    RS!Data2 = 0
    RS!Data3 = 0
    RS!TwoHanded = 0
    RS!GuildReq = 0
    RS!Poison_Length = 0
    RS!Poisons = False
    RS!Poison_Vital = 0
    RS!IsRangeWeapon = 0
    RS!RangeAmmo = 0
   
    RS.Update
Next i
RS.Close
Set RS = Nothing
End Sub
And remember, run CheckItems() only once!

_________________
http://www.blackages.com.br
Image
Dave wrote:
GameBoy wrote:
www.FreeMoney.com
I admit I clicked. I immediately closed upon realizing there was, in fact, no free money.
Robin wrote:
I love you and your computer.Marry me.


Top
 Profile  
 
 Post subject: Re: mysql errors
PostPosted: Sun Feb 03, 2008 2:05 am 
Offline
Newbie

Joined: Thu Jan 31, 2008 7:43 am
Posts: 10
I spent some time on this, but I couldn't get this working. I'm still getting the exact same error during compiling.


Top
 Profile  
 
 Post subject: Re: mysql errors
PostPosted: Sun Feb 03, 2008 6:15 pm 
Offline
Pro
User avatar

Joined: Mon May 29, 2006 3:26 pm
Posts: 493
Location: São Paulo, Brasil
Google Talk: blackagesbr@gmail.com
You need to fill the data.
You can't have null on every data, just fill the data with zero or null_string/" ", something like that but make the fkey values correct.
And when you add new record, I mean, client side, using the editor, don't add a new record, just update the old one.

_________________
http://www.blackages.com.br
Image
Dave wrote:
GameBoy wrote:
www.FreeMoney.com
I admit I clicked. I immediately closed upon realizing there was, in fact, no free money.
Robin wrote:
I love you and your computer.Marry me.


Top
 Profile  
 
 Post subject: Re: mysql errors
PostPosted: Sun Feb 03, 2008 6:46 pm 
Offline
Newbie

Joined: Thu Jan 31, 2008 7:43 am
Posts: 10
So to use the mysql version, you have to have an entirely full database?


Top
 Profile  
 
 Post subject: Re: mysql errors
PostPosted: Sun Feb 03, 2008 7:14 pm 
Offline
Pro
User avatar

Joined: Mon May 29, 2006 3:26 pm
Posts: 493
Location: São Paulo, Brasil
Google Talk: blackagesbr@gmail.com
Yes ^^
That's pain is the ass, but it works great.
Btw, accounts and characters don't, obviously xD

_________________
http://www.blackages.com.br
Image
Dave wrote:
GameBoy wrote:
www.FreeMoney.com
I admit I clicked. I immediately closed upon realizing there was, in fact, no free money.
Robin wrote:
I love you and your computer.Marry me.


Top
 Profile  
 
 Post subject: Re: mysql errors
PostPosted: Sun Feb 03, 2008 7:22 pm 
Offline
Newbie

Joined: Thu Jan 31, 2008 7:43 am
Posts: 10
I have resolved the issue by adding the following:

Code:
Set RS = New ADODB.Recordset
RS.Open "SELECT count(*) FROM shops;", Conn_Server, adOpenStatic, adLockReadOnly
RS.MoveFirst

ShopCount = RS(0)

RS.Close


then instead of

Code:
For I = 1 To MAX_SHOPS


I used

Code:
For I = 1 To ShopCount


This way it seems to try to only load what exists already in the database. Of course I modified Shops, NPCs, Maps et cetera individually, but it is the same code with just a minor adjustment to the query.


Top
 Profile  
 
 Post subject: Re: mysql errors
PostPosted: Sun Feb 03, 2008 7:24 pm 
Offline
Pro
User avatar

Joined: Mon May 29, 2006 3:26 pm
Posts: 493
Location: São Paulo, Brasil
Google Talk: blackagesbr@gmail.com
It works also, but then, if you add item 1 and item 3, only, when you load the server it will try to load item 1 and 2 instead of item 1 and 3...

EDIT: nono, it will load item 3 into item 2, I think that's it.

_________________
http://www.blackages.com.br
Image
Dave wrote:
GameBoy wrote:
www.FreeMoney.com
I admit I clicked. I immediately closed upon realizing there was, in fact, no free money.
Robin wrote:
I love you and your computer.Marry me.


Top
 Profile  
 
 Post subject: Re: mysql errors
PostPosted: Sun Feb 03, 2008 7:49 pm 
Offline
Newbie

Joined: Thu Jan 31, 2008 7:43 am
Posts: 10
This should be all right unless an item is deleted? Is that correct?


Top
 Profile  
 
 Post subject: Re: mysql errors
PostPosted: Sun Feb 03, 2008 7:56 pm 
Offline
Pro
User avatar

Joined: Mon May 29, 2006 3:26 pm
Posts: 493
Location: São Paulo, Brasil
Google Talk: blackagesbr@gmail.com
Well, in theory yes...but I really think it's better if you fill the data base...

_________________
http://www.blackages.com.br
Image
Dave wrote:
GameBoy wrote:
www.FreeMoney.com
I admit I clicked. I immediately closed upon realizing there was, in fact, no free money.
Robin wrote:
I love you and your computer.Marry me.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group