A consult - Mailing list pgadmin-hackers
From | Gastón Micheri |
---|---|
Subject | A consult |
Date | |
Msg-id | F120LmZv4Qbbr8zpwoW0000d02f@hotmail.com Whole thread Raw |
List | pgadmin-hackers |
<div style="background-color:"><div><div><div></div><div><div><font face="Arial"><em>Hello, I have this problem. Anybodycan help me?</em></font></div><div><em><font face="Arial">Thanx!</font></em></div><div><font face="Arial"></font> </div><div><fontface="Arial"><strong><u>Bug using ADODB and Visual Basic for acceding PSQL<br /></u></strong></font></div><div><fontface="Arial" size="2">We have a problem using ADODB (from Visual Basic) and POSTGRESQLwhen trying to use an unconnected recordset </font><font face="Arial" size="2">which´s property "locktype" is setto "adLockBatchOptimistic" (Rs.locktype=adLockBatchOptimistic). </font><font face="Arial" size="2">When trying to accessto a database through ODBC, using ADODB, we have noticed an important delay </font><font face="Arial" size="2">in comparisonto other databases such as SQLServer. </font><font face="Arial" size="2">Investigating this problem, we have detectedwhere that delay is produced. </font><font face="Arial" size="2">The problem is produced when we are trying to getan unconnected recordset with the </font><font face="Arial" size="2">"adLockBatchOptimistic" block type. </font><fontface="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 othertwo are not.</font></div><div><font face="Arial" size="2">We conclude that the last two results are important to recoverthe recordset structure </font><font face="Arial" size="2">that will be disconnected later.</font></div><div><fontface="Arial" size="2">The problem is that one of this two extra queries runs a complete selectover 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><fontface="Arial" size="2">talbe recordsets.</font><font face="Arial" size="2">But this records are not kept intothe recordset. It only brings the data requested by the </font><font face="Arial" size="2">written sentence.</font><fontface="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> </div><fontface="Arial" size="2"><div><br /><u><strong><font size="3">Visual Basic Code</font></strong></u><br/><br /> <br /> Dim objRs As New ADODB.Recordset<br /> Dim objConn As New ADODB.Connection<br/> Dim strSql As String<br /> Dim strCadenaConexion As String<br /> <br /> strCadenaConexion = _<br/> "DSN=contabilidad_psql;DATABASE=contabilidad;" & _<br /> "SERVER=192.168.1.41;PORT=5432;UID=credito;PWD=;"<br/> <br /> objConn.Open strCadenaConexion<br /> <br /> strSql = "select* from agentes where id_sucursal = 7 and id_agente = 100"<br /> <br /> objRs.CursorLocation = adUseClient<br /> objRs.CursorType = adOpenStatic<br /> objRs.LockType = adLockBatchOptimistic<br /> <br /> Set objRs.ActiveConnection= objConn<br /> objRs.Open strSql<br /> <br /> objRs.ActiveConnection = Nothing<br /> objConn.Close<br/> <br /> MsgBox "Cant: " & objRs.RecordCount<br /> <br /> <br /> <br /><u><font size="3"><strong>LogODBC POSTGRE <br /></strong></font></u><br /> <br /> conn=409745072, query='select * from agentes whereid_sucursal = 7 and id_agente = 100'<br /> [ fetched 1 rows ]<br /> conn=409745072, query='SELECT * FROM agentes'<br/> [ fetched 10773 rows ]<br /> conn=409745072, query='select ta.attname, ia.attnum from pg_attribute ta, pg_attributeia, 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 /> [fetched 2 rows ]<br /> conn=409745072, PGAPI_Disconnect<br /></div><div>I hope you could help us to solve this problem.</div><div>Thankyou!</div><div>Gastón</div></font></div></div></div></div><br clear="all" /><hr />Descargue GRATUITAMENTEMSN Explorer en <a href="http://g.msn.com/1HM105901/N">http://explorer.yupimsn.com/intl.asp</a>.<br />
pgadmin-hackers by date: