<br><br><div class="gmail_quote">On Thu, Aug 26, 2010 at 9:43 PM, Mariano Martinez Peck <span dir="ltr"><<a href="mailto:marianopeck@gmail.com">marianopeck@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br><br><div class="gmail_quote"><div class="im">On Wed, Aug 25, 2010 at 7:20 AM, Panu Suominen <span dir="ltr"><<a href="mailto:panu.j.m.suominen@gmail.com" target="_blank">panu.j.m.suominen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
2010/8/24 Mariano Martinez Peck <<a href="mailto:marianopeck@gmail.com" target="_blank">marianopeck@gmail.com</a>>:<br>
<div><br>
> Yes. So that I can see it. Do you know if it breaks compatibility with other<br>
> databases or OS? because SqueakDBX classes like DBXConnection should be<br>
> cross-backend.<br>
<br>
</div>I don't know how cross-platform my fix is. Database part should be<br>
fine. Postgresql can now detect the encoding.<br></blockquote></div><div><br>Thanks a lot for the changeset. Now I will test with different OS and databases and I will let you know. <br> <br>now a couple of questions:<br>
<br>- I guess a lot of people doesn't need UTF (or other) encoding. And I guess that the transformation brings some overhead in the query result mosty...(I should run the benchmarks and see if there is difference). But I was thinking if we could make this optional. I like the code and design you did. I think that a good idea would be to add some kind of NullEncoder which is set in: <br>
<br></div></div></blockquote><div><br>Ok.... I run the benchmarks and I was rigth ;)<br><br>Before:<br><br>Benchmarking: DBXTinyBenchmarks (10 runs)<br>benchmarkInsert: 521.4 AVG<br>benchmarkInsertConverted: 795.9 AVG<br>
benchmarkSelect10: 2.5 AVG<br>benchmarkSelect100: 17.5 AVG<br>benchmarkSelect1000: 167.4 AVG<br>benchmarkSelect10000: 1691.9 AVG<br><br><br>After:<br><br>Benchmarking: DBXTinyBenchmarks (10 runs)<br>benchmarkInsert: 643.2 AVG<br>
benchmarkInsertConverted: 905.6 AVG<br>benchmarkSelect10: 3.8 AVG<br>benchmarkSelect100: 25.1 AVG<br>benchmarkSelect1000: 246.4 AVG<br>benchmarkSelect10000: 2577.6 AVG<br><br><br>In addition, several SqueakDBX tests were failing with your changes...In order to have all green tests, I had to do:<br>
<br>fieldRawValue: anIndex on: aResultSet<br> "Returns the value of the column at anIndex of the current row from aResultSet"<br> | raw |<br> raw := (OpenDBX current apiQueryFieldValue: (aResultSet handle) index: (anIndex - 1)). <br>
raw isNil ifFalse: [^aResultSet connection encoder convertFromSystemString: raw].<br> ^ nil <br><br><br>Panu, I really appreciate your help. I am happy to integrate this change when we can make it option :)<br>
<br><br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="gmail_quote"><div>DBXConnection >> initialize<br><br>instead of TextConverter newForEncoding: #utf8.<br>
<br>Then, for postgres, you will be using the one from TextConverter newForEncoding: (r rows first valueAt: 1).<br><br>Even more, I would like to make it optional. Maybe we can create DBXCOnnection class >> platform: aPlatform settings: aConnectionSettings encode: anEncoder<br>
and that will do:<br><br>platform: aPlatform settings: aConnectionSettings encoder: anEncoder<br> ^self new<br> platform: aPlatform;<br> settings: aConnectionSettings;<br> encoder: anEncoder;<br> yourself<br>
<br>Finally, the cleint code (your app code) creates the connection with that message :)<br><br>or something like that....but the idea of making it optional not to have overhead if not required, and being able to be enabled from the app code.<br>
<br>- What happens is the database supports and specific encoding that Pharo doesn't support?<br> TextConverter newForEncoding: (r rows first valueAt: 1).<br><br>will return nil, causing UndefinedObject dnu something.<br>
<br>maybe we can just set again the NullEncoder in that case? or raise an error ? what do you think?<br><br><br></div><div class="im"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Others database platforms just don't know anything about encoding<br>
(they use default utf-8). If other smalltalk dialects have<br>
TextConverter then it should be fine.<br>
If they haven't then I can implement another abstraction layer to<br>
provide compatibility between dialects.<br>
<div><br>
> If you want to can use another new package with your commit.<br>
</div>I am sorry, but I did not quite understand what you meant...<br>
<br>
Unfortunately I am a little busy at work right now so I did not had<br>
time to learn how to use monticello properly to create version only<br>
containing required changes.<br>
For this reason I attached change set file to this mail.<br></blockquote></div><div><br>Don't worry :) <br><br>thanks!<br> </div><div class="im"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><br>
>> Also is there a connection pooling facility for SqueakDBX or Glorp?<br>
> Yes, several.<br>
</div>Thank you.<br>
<br>
--<br>
<font color="#888888">Panu<br>
</font></blockquote></div></div><br>
</blockquote></div><br>