Re: [api-dev] Possible bug with MySQL and OOo ResultSet
Hi Frank, Sergio, It would appear that the 3.51 ODBC driver only supports dynamic cursors in FORWARD_ONLY and STATIC modes if this page is correct : http://www.verbose.fr/mysql_5.0/mysql-connectors.html 25.1.14.2. Est-ce que MyODBC accepte les curseurs dynamiques? Oui. MyODBC 3.51 supporte les curseurs dynamiques avec les modes Forward-only et static. A cause des problèmes de performances, le pilote ne supporte pas cette fonctionnalité par défaut. Vous pouvez l'activer en spécifiant l'option de connexion OPTION=32 ou en cliquant dans l'option Enable Dynamic Cursor dans le panneau de configuration DSN. For those who don't speak French : Does MyODBC accept dynamic cursors? Yes. MyODBC 3.51 supports dynamic cursors in Forward-Only and Static modes For performance reasons, the driver does not enable this functionality by default. It can be activated by specifying the connection option OPTION=32 or by clicking on the Enable Dynamic Cursor tickbox in the DSN configuration panel. Alex - Frank Schoenheit, Sun Microsystems Germany frank.schoenh...@sun.com a écrit : Hi Sergio, oStmt = oConn.createStatement() oStmt.setPropertyValue(ResultSetType, com.sun.star.sdbc.ResultSetType.SCROLL_INSENSITIVE) oStmt.setPropertyValue(ResultSetConcurrency, com.sun.star.sdbc.ResultSetConcurrency.READ_ONLY) oRs = oStmt.executeQuery(sql_string) oRs.next c = oRs.getRow print c '= 1 oRs.next print oRs.getRow '= 2 oRs.absolute(c) 'give False with MySQL only print oRs.getRow '= 2 ***error*** with MySQL only If I connect to HSQL, it works giving 1 at the end, while if I connect to MySQL, it return 2 at the end. Do I make an error? MySQL 5.1.40 - Connector 3.51.27 - OOo 3.1.1 In general, the result set type you specify (SCROLL_INSENSITIVE, in your example) is a request which might not necessarily be fulfilled by the database driver. That is, the driver is free to downgrade it, if it doesn't support a particular type. Whether this downgrade happens silently, or with a warning (or not at all, but execution would fail), is at the discretion of the driver. That said, it might be (do not know this out of my head) that the MySQL Connector decided to downgrade your result set type to FORWARD_ONLY. In this case, absolute is not expected to work, only next can be used then. Provided that the driver provides proper information, you can check this with Print oRs.ResultSetType ' should be 1004 [1] , or, if you need the information before actually executing the statement: Print oConn.MetaData.supportsResultSetConcurrency( _ com.sun.star.sdbc.ResultSetType.SCROLL_INSENSITIVE, _ com.sun.star.sdbc.ResultSetConcurrency.READ_ONLY ) (However, the latter method is known to be improperly implemented by some drivers, though I think the MySQL Connector is not amongst those.) If you find that indeed the SCROLL_INSENSITIVE type is not supported by the driver, then you might consider upgrading the Connector/ODBC - finally, the 3.51 series is *really* old meanwhile. Ciao Frank [1]http://api.openoffice.org/docs/common/ref/com/sun/star/sdbc/ResultSetType.html p.s. If I connect with extension native driver for OOo, it works, so I'll use it, but it would be however a bug. And in Ubuntu, wich use MySQL 5.0.75, native connector is not available. - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org -- - Frank Schönheit, Software Engineer frank.schoenh...@sun.com - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Base http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Mailmerge + SQL query ?
Aladdin a écrit : Hi, Is there anything else to do than : myMailMerge.CommandType = com.sun.star.sdb.CommandType.COMMAND myMailMerge.Command = SELECT * FROM biblio I think you would probably need to establish a connection to the database source and a db context first, and you would probably have to execute the SQL rather than just use command. Alex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Programming SDK without X Server?
Juergen Schmidt wrote: Sorry for this kind of ad but even buying StarOffice/StarOffice Server is more or less a direct support/sponsoring of OpenOffice ;-) We've all got to make a living ;-) Alex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] Unexepected null character
Hi, The following problem has just come up on the French N-L prog list. I've translated the OP from French into English for everyone below : As I've said already, I'm learning OOo Macros with Writer and Windows and don't know if this problem is particular to Windows. Paragraph returns are counted as a single character in cursor movements, but are counted as two in strings that are delimited by cursors. The following macro opens a new empty Writer document and inserts 2048 identical lines, each line being made up of the first 15 smallcaps characters a to o and a paragraph return. We thus have 2048 x 16 = 32768 characters, if we count a paragraph return as one character. Next, the macro extends a cursor over 32767 positions from the beginning of the text. A paragraph return here counts as a single position. The macro then returns a MsgBox indicating the Asc value of the rightmost character (Right(..., 1) ) of the string covered by the cursor (String property of the cursor). THe unexpected result : the Asc value returned is zero. The macro then returns a un MsgBox indicating the length (Len) of the string under scrutiny. Since there are 2047 paragraph returns in the area covered by the cursor and because paragraph returns count twice, one would expect the length to be 32767 + 2047 = 34814, but the message indicates 34815. So it looks like that there is an extra null character. Quelqu'un peut-il m'expliquer ces deux résultats ? This has been confirmed by another person on the same list. The code snippet is below : [code] Sub DebugUnicodeString Dim monDocument As Object Dim CurseurVisible As Object Dim i As Long Dim carSpecial As Integer Dim ourText As Object Dim auxCursor As Object Dim ourString As String Dim propFich() monDocument = StarDesktop.LoadComponentFromURL(private:factory/swriter, _blank, 0, propFich) ' I suppose that monDocument is now identical to ThisComponent. CurseurVisible = ThisComponent.CurrentController.getViewCursor() ourText = CurseurVisible.getText() ' I suppose that ourText = monDocument.getText() are two ways of expressing the same thing. carSpecial = com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK For i = 1 To 2048 ourText.insertString(CurseurVisible, abcdefghijklmno, False) ourText.insertControlCharacter(CurseurVisible, carSpecial, False) Next ' The document thus contains 2048 X 16 = 32768 characters, ' where a paragraph return counts as one character. auxCursor = ourText.createTextCursor() ' at the beginning of the text. auxCursor.goRight(32767, True) ' The following line just checks that auxCursor stops just before the ' last character' (paragraph return) inserted by the macro. CurseurVisible.goToRange(auxCursor.getEnd(), False) ' OK. ' Even if there a difference of just one position corresponds ' to two string characters (Chr(13) Chr(10)), 32767 positions ' will make at most a string of 65534 characters, ' thus auxCursor.getString() shouldn't misfunction ourString = auxCursor.getString() '' MsgBox The last character of ourString, given by Right(..., 1) has the Asc value of : Asc(Right(ourString, 1)) ' With a document containing 2024 lines each one of which has 15 ' smallcaps letters from a to o ' and a paragraph return, the preceding MsgBox displays Asc as 0. ??? MsgBox The length of ourString is Len(ourString) ' With a document having 2024 lines each one of which has 15 smallcaps ' letters from a to o and a paragraph return ' the preceding MsgBox displays 34815 (whereas it apparently ' should be 34814). End Sub [/code] Any advice, or is this a bug, and if so, where ? Alex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] com.sun.star.mail
Peter Eberlein wrote: Hi, I can connect to SMTP (thanks to ms777) with the following snippet, but found no way to instanciate a com.sun.star.mail.MailMessage (CreateUNOService(com.sun.star.mail.MailMessage) gives me a null-object). Is this interface not a left over stub from StarOffice, which used to have a mailer component ? I thought that this had been withdrawn from the code along with the all-in-one desktop interface. Alex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Selecting Printer always uses default Printer (BUG?)
Tobias Krais wrote: Hi, Please tell me, is this a feature or a bug? Do you have the same problem? In case you want to test it I can send you an sample application. My guess is that this is a bug. The environment should detect CUPS settings automatically, since this is what happens in the UI, but perhaps they need to be instantiated somewhere. Alex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]