A consult

From: Gastón Micheri <gmicheri(at)hotmail(dot)com>
To: pgadmin-hackers(at)postgresql(dot)org
Subject: A consult
Date: 2002-03-06 19:58:32
Message-ID: F120LmZv4Qbbr8zpwoW0000d02f@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

<html><div style='background-color:'><DIV>
<DIV>
<DIV></DIV>
<DIV>
<DIV><FONT face=Arial><EM>Hello, I have this problem. Anybody can help me?</EM></FONT></DIV>
<DIV><EM><FONT face=Arial>Thanx!</FONT></EM></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><STRONG><U>Bug using ADODB and Visual Basic for acceding PSQL<BR></DIV></U></STRONG></FONT>
<DIV><FONT face=Arial size=2>We have a problem using ADODB (from Visual Basic) and POSTGRESQL when trying to use an unconnected recordset </FONT><FONT face=Arial size=2>which´s property "locktype" is set to "adLockBatchOptimistic" (Rs.locktype=adLockBatchOptimistic). </FONT><FONT face=Arial size=2>When trying to access to a database through ODBC, using ADODB, we have noticed an important delay </FONT><FONT face=Arial size=2>in comparison to other databases such as SQLServer. </FONT><FONT face=Arial size=2>Investigating this problem, we have detected where that delay is produced. </FONT><FONT face=Arial size=2>The problem is produced when we are trying to get an unconnected recordset with the </FONT><FONT face=Arial size=2>"adLockBatchOptimistic" block type. </FONT><FONT face=Arial size=2>When it is trying to execute the query (tracing it) we have seen that arrives three select </FONT><FONT face=Arial size=2>results, but only one of them corresponds to the sentence of the query but the other two are not.</FONT></DIV>
<DIV><FONT face=Arial size=2>We conclude that the last two results are important to recover the recordset structure </FONT><FONT face=Arial size=2>that will be disconnected later.</FONT></DIV>
<DIV><FONT face=Arial size=2>The problem is that one of this two extra queries runs a complete select over the table that we </FONT><FONT face=Arial size=2>are accessing with the written select.</FONT><FONT face=Arial size=2>This table has a lot of records, and it turns the answer really slow because it brings all the </FONT><FONT face=Arial size=2>talbe recordsets.</FONT><FONT face=Arial size=2>But this records are not kept into the recordset. It only brings the data requested by the </FONT><FONT face=Arial size=2>written sentence.</FONT><FONT face=Arial size=2>Now, we present the Visual Basic code used to access the database and, after that, a log obtained </FONT><FONT face=Arial size=2>through POSTGRE ODBC.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV><FONT face=Arial size=2>
<DIV><BR><U><STRONG><FONT size=3>Visual Basic Code</FONT></STRONG></U><BR><BR>&nbsp;<BR>&nbsp; Dim objRs As New ADODB.Recordset<BR>&nbsp; Dim objConn As New ADODB.Connection<BR>&nbsp; Dim strSql As String<BR>&nbsp; Dim strCadenaConexion As String<BR>&nbsp; <BR>&nbsp; strCadenaConexion = _<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "DSN=contabilidad_psql;DATABASE=contabilidad;" &amp; _<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "SERVER=192.168.1.41;PORT=5432;UID=credito;PWD=;"<BR>&nbsp; <BR>&nbsp; objConn.Open strCadenaConexion<BR>&nbsp;<BR>&nbsp; strSql = "select * from agentes where id_sucursal = 7 and id_agente = 100"<BR>&nbsp; <BR>&nbsp; objRs.CursorLocation = adUseClient<BR>&nbsp; objRs.CursorType = adOpenStatic<BR>&nbsp; objRs.LockType = adLockBatchOptimistic<BR>&nbsp;<BR>&nbsp; Set objRs.ActiveConnection = objConn<BR>&nbsp; objRs.Open strSql<BR>&nbsp;<BR>&nbsp; objRs.ActiveConnection = Nothing<BR>&nbsp; objConn.Close<BR>&nbsp; <BR>&nbsp; MsgBox "Cant: " &amp; objRs.RecordCount<BR>&nbsp;<BR>&nbsp;<BR>&nbsp;<BR><U><FONT size=3><STRONG>Log ODBC POSTGRE&nbsp;<BR></STRONG></FONT></U><BR>&nbsp;<BR>&nbsp;conn=409745072, query='select * from agentes where id_sucursal = 7 and id_agente = 100'<BR>&nbsp;[ fetched 1 rows ]<BR>&nbsp;conn=409745072, query='SELECT * FROM agentes'<BR>&nbsp;[ fetched 10773 rows ]<BR>&nbsp;conn=409745072, query='select ta.attname, ia.attnum from pg_attribute ta, pg_attribute ia, pg_class c, pg_index i where c.relname = 'agentes' AND c.oid = i.indrelid AND i.indisprimary = 't' AND ia.attrelid = i.indexrelid AND ta.attrelid = i.indrelid AND ta.attnum = i.indkey[ia.attnum-1] order by ia.attnum'<BR>&nbsp;[ fetched 2 rows ]<BR>&nbsp;conn=409745072, PGAPI_Disconnect<BR></DIV>
<DIV>I hope you could help us to solve this problem.</DIV>
<DIV>Thank you!</DIV>
<DIV>Gastón</DIV></FONT></DIV></DIV></DIV></div><br clear=all><hr>Descargue GRATUITAMENTE MSN Explorer en <a href='http://g.msn.com/1HM105901/N'>http://explorer.yupimsn.com/intl.asp</a>.<br></html>

Attachment Content-Type Size
unknown_filename text/html 4.3 KB

Browse pgadmin-hackers by date

  From Date Subject
Next Message Tim Finch, FosterFinch Ltd 2002-03-06 22:02:46 Devel / Release on same pc / Mark's ZIP of Designer code
Previous Message Dave Page 2002-03-06 11:52:16 Re: Here we go....