Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 MySql Compatibility in Mods
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Shade
Starting Member

Indonesia
15 Posts

Posted - 27 February 2002 :  07:05:22  Show Profile  Visit Shade's Homepage
Please consider MySql compability in any mod espescially mod that included rs.absolutepage. Example:

set rs = Server.CreateObject("ADODB.Recordset")
'## Forum_SQL
strSql ="SELECT " & strTablePrefix & "ONLINE.UserID, " & strTablePrefix & "ONLINE.UserIP, " & strTablePrefix & "ONLINE.M_BROWSE, " & strTablePrefix & "ONLINE.DateCreated, " & strTablePrefix & "ONLINE.LastChecked, " & strTablePrefix & "ONLINE.CheckedIn, " & strTablePrefix & "ONLINE.SystemOS, " & strTablePrefix & "ONLINE.BrowserTYPE "
strSql = strSql & " FROM " & strMemberTablePrefix & "ONLINE "
strSql = strSql & " ORDER BY " & strTablePrefix & "ONLINE.DateCreated, " & strTablePrefix & "ONLINE.CheckedIn DESC"

rs.cachesize = 20
rs.open strSql, my_Conn, 3

i = 0

If rs.EOF or rs.BOF then '## No categories found in DB
Response.Write ""
Else

rs.movefirst
num = 0
rs.pagesize = mypagesize
maxpages = cint(rs.pagecount)
maxrecs = cint(rs.pagesize)
rs.absolutepage = mypage ------------>Error on MySql
howmanyrecs = 0
rec = 1
do until rs.EOF or (rec = mypagesize+1)
if strI = 0 then
CColor = strAltForumCellColor
else
CColor = strForumCellColor
end if
--snip--


This code always cause error on MySql.
Snitz Forum 2000 version 3.3.03 already change that code to something like this:

strSql ="SELECT " & strTablePrefix & "ONLINE.UserID, " & strTablePrefix & "ONLINE.UserIP, " & strTablePrefix & "ONLINE.M_BROWSE, " & strTablePrefix & "ONLINE.DateCreated, " & strTablePrefix & "ONLINE.LastChecked, " & strTablePrefix & "ONLINE.CheckedIn, " & strTablePrefix & "ONLINE.SystemOS, " & strTablePrefix & "ONLINE.BrowserTYPE "
strSql = strSql & " FROM " & strMemberTablePrefix & "ONLINE "
strSql = strSql & " ORDER BY " & strTablePrefix & "ONLINE.DateCreated, " & strTablePrefix & "ONLINE.CheckedIn DESC"

set rs = Server.CreateObject("ADODB.Recordset")

if strDBType = "mysql" then 'MySql specific code
if mypage > 1 then
intOffset = CInt((mypage-1) * strPageSize)
strSql = strSql & " LIMIT " & intOffset & ", " & strPageSize & " "
end if

'## Forum_SQL - Get the total pagecount
strSql2 ="SELECT COUNT(" & strTablePrefix & "ONLINE.UserID) AS ACTIVECOUNT"
strSql2 = strSql2 & " FROM " & strMemberTablePrefix & "ONLINE "

set rsCount = my_Conn.Execute(strSql2)

if not rsCount.eof then
maxpages = (rsCount("ACTIVECOUNT") \ strPageSize )
if rsCount("ACTIVECOUNT") mod strPageSize <> 0 then
maxpages = maxpages + 1
end if
else
maxpages = 1
end if

rsCount.close
set rsCount = nothing

rs.open strSql, my_Conn, 3
if not(rs.EOF) then
rs.movefirst
end if
else

rs.cachesize = 20
rs.open strSql, my_Conn, 3

If rs.EOF or rs.BOF then '## No categories found in DB
Response.Write ""
Else

rs.movefirst
rs.pagesize = mypagesize
maxpages = cint(rs.pagecount)
maxrecs = cint(rs.pagesize)
rs.absolutepage = mypage
end if
end if
i = 0
num = 0
howmanyrecs = 0
rec = 1

'start the loop


It will save MySql-based users time trying to fix it.

  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.19 seconds. Powered By: Snitz Forums 2000 Version 3.4.07