Is it borked or am I insane?

4 views
Skip to first unread message

Pierre Phaneuf

unread,
Oct 14, 2007, 9:09:24 PM10/14/07
to Schedulator
I had the hardest time getting Schedulator to work on my laptop here,
for some testing, following the instructions in that other thread
here, but I finally got it working with the following patch:

Index: wvdbi.cs
===================================================================
--- wvdbi.cs (revision 11823)
+++ wvdbi.cs (working copy)
@@ -19,7 +19,7 @@
{
StringDictionary sect = settings[odbcstr];

- string s =
wv.fmt("driver={{{0}}};server={1};database={2};"
+ string s =
wv.fmt("driver={0};server={1};database={2};"
+ "uid={3};pwd={4};",
sect["driver"], sect["server"],
sect["database"],

So, was that an actual bug or am I insane? Because that looks like a
rather specific thing to be an actual bug...

Avery Pennarun

unread,
Oct 16, 2007, 10:55:02 AM10/16/07
to sched...@googlegroups.com
On 14/10/2007, Pierre Phaneuf <ppha...@gmail.com> wrote:
> - string s = wv.fmt("driver={{{0}}};server={1};database={2};"
> + string s = wv.fmt("driver={0};server={1};database={2};"
>
> So, was that an actual bug or am I insane? Because that looks like a
> rather specific thing to be an actual bug...

In .net format strings, {{ is reduced to a single { and }} is reduced
to a single }. Thus, if {0} is foo, then {{{0}}} is {foo}. It
appears that putting braces around the driver string is the way to
escape spaces, punctuation, etc. At least, at the time, that was the
only way to make it work.

That said, it might be an odbc-version-specific thing, a
mysql-specific thing, or a mono-version-specific thing. I just found
it by doing a lot of web searches at the time.

If your driver string in odbcinst.ini (I think) has no fancy
characters, it'll work without the extra braces, but you might have
broken behaviour with the "default" mysql driver name string of "MySQL
blah blah vblah.blah" or whatever it is. On the other hand, it's
annoying that it doesn't work reliably for you with the braces.

What version of mono are you using? What database type?

Have fun,

Avery

Pierre Phaneuf

unread,
Oct 16, 2007, 11:19:02 AM10/16/07
to sched...@googlegroups.com
On 10/16/07, Avery Pennarun <apen...@gmail.com> wrote:

> In .net format strings, {{ is reduced to a single { and }} is reduced
> to a single }. Thus, if {0} is foo, then {{{0}}} is {foo}.

That much I had figured out.

> It appears that putting braces around the driver string is the way to
> escape spaces, punctuation, etc. At least, at the time, that was the
> only way to make it work.

That, on the other hand, doesn't seem to be true on my box...

> If your driver string in odbcinst.ini (I think) has no fancy
> characters, it'll work without the extra braces, but you might have
> broken behaviour with the "default" mysql driver name string of "MySQL
> blah blah vblah.blah" or whatever it is. On the other hand, it's
> annoying that it doesn't work reliably for you with the braces.
>
> What version of mono are you using? What database type?

I'm using Ubuntu "feisty", with everything coming from them (it's on
my desktop machine at home, which is not accessible to me at the
moment, sorry). I'm using MySQL, for which I installed the libmyodbc
package. I remember using /usr/share/libmyodbc/odbcinst.ini as the
"template file" parameter when invoking odbcinst (of note, other ODBC
driver packages on Ubuntu ran this automatically in their post-install
script, but not this one!?!). The driver name in there was just
"MySQL" (no quotes).

The mono package version is 1.2.3.1-1ubuntu1.

I would have liked to use SQLite, actually, but I figured I'd go with
MySQL first, guessing it was probably better tested...

--
http://pphaneuf.livejournal.com/

Avery Pennarun

unread,
Oct 16, 2007, 11:47:23 AM10/16/07
to sched...@googlegroups.com
On 16/10/2007, Pierre Phaneuf <ppha...@gmail.com> wrote:
> I'm using Ubuntu "feisty", with everything coming from them (it's on
> my desktop machine at home, which is not accessible to me at the
> moment, sorry). I'm using MySQL, for which I installed the libmyodbc
> package. I remember using /usr/share/libmyodbc/odbcinst.ini as the
> "template file" parameter when invoking odbcinst (of note, other ODBC
> driver packages on Ubuntu ran this automatically in their post-install
> script, but not this one!?!). The driver name in there was just
> "MySQL" (no quotes).

Okay, well your system seems more sensible than mine, so feel free to
check in the fix.

The Debian/Ubuntu odbc setup stuff is a big pile of crap, so no
surprise that it didn't so anything sensible. Kind of funny that ODBC
actually *works* quite well in Unix, but setting it up (which is
technically the easy part) is such a total nightmare.

Have fun,

Avery

Pierre Phaneuf

unread,
Oct 16, 2007, 11:54:31 AM10/16/07
to sched...@googlegroups.com
On 10/16/07, Avery Pennarun <apen...@gmail.com> wrote:

> Okay, well your system seems more sensible than mine, so feel free to
> check in the fix.

I guess that it's easier to add the braces in the .sched file than to
edit the source code to take them out...

--
http://pphaneuf.livejournal.com/

Avery Pennarun

unread,
Oct 16, 2007, 11:58:29 AM10/16/07
to sched...@googlegroups.com
On 16/10/2007, Pierre Phaneuf <ppha...@gmail.com> wrote:
> On 10/16/07, Avery Pennarun <apen...@gmail.com> wrote:
> > Okay, well your system seems more sensible than mine, so feel free to
> > check in the fix.
>
> I guess that it's easier to add the braces in the .sched file than to
> edit the source code to take them out...

Also very true. Or in wvodbc.ini (the recommended approach) for that matter.

Avery

Pierre Phaneuf

unread,
Oct 16, 2007, 12:05:16 PM10/16/07
to sched...@googlegroups.com
On 10/16/07, Avery Pennarun <apen...@gmail.com> wrote:

> > I guess that it's easier to add the braces in the .sched file than to
> > edit the source code to take them out...
>
> Also very true. Or in wvodbc.ini (the recommended approach) for that matter.

Oh, yes, that's what I meant, actually.

--
http://pphaneuf.livejournal.com/

Reply all
Reply to author
Forward
0 new messages