Thread overview
Help Building DBI
Jan 05, 2007
jicman
Jan 05, 2007
Brad Anderson
Jan 05, 2007
Marcin Kuszczak
Jan 05, 2007
jicman
Jan 05, 2007
jicman
January 05, 2007
Greetings!  Congratulations to all of us for 1.0!  Woowoowoowoooooo!

Sorry to ask about this on this newsgroup, but I am kinda trapped for time and the DBI forum on dsource.org is kinda slow and perhaps I get faster response here.  Thanks.

Ok, so I want to compile this test program,

----------------
import dbi.sqlite.SqliteDatabase;
import dbi.Row;
//import dbi.all;
import std.stdio;

void main() {
  char[] sqldb  = r"C:\OpenJobs.db";
  SqliteDatabase db = new SqliteDatabase();
  db.connect(sqldb);

  Row[] rows = db.queryFetchAll("SELECT * FROM sqlite_master WHERE
type='table' AND name='LSOpenJobs'");
  foreach (Row row; rows)
  {
    writefln("username: %s Project: %s\n", row["login"], row
["proj"]);
  }

  db.close();
}

----------------

But I am getting this error,

23:24:19.89>build -clean dbitest.d
dbitest.d(1): module SqliteDatabase cannot read
file 'dbi\sqlite\SqliteDatabase.d'

I tried to build dbi, and here is what I get,

23:24:42.54>dmd -run buildme.d sqlite
Digital Mars Librarian Version 8.00n
Copyright (C) Digital Mars 2000-2002 All Rights Reserved
www.digitalmars.com
Digital Mars Librarian complete.

I took the dbi.lib and placed it on c:\dmd\lib and I get the same thing.

Any ideas as to what to do to get this above program compiled?

Thanks so much.

josé
January 05, 2007
jicman wrote:
> Greetings!  Congratulations to all of us for 1.0!  Woowoowoowoooooo!
> 
> Sorry to ask about this on this newsgroup, but I am kinda trapped for time and the DBI forum on dsource.org is kinda slow and perhaps I get faster response here.  Thanks.
> 
> Ok, so I want to compile this test program,
> 
> ----------------
> import dbi.sqlite.SqliteDatabase;
> import dbi.Row;
> //import dbi.all;
> import std.stdio;
> 
> void main() {
>   char[] sqldb  = r"C:\OpenJobs.db";
>   SqliteDatabase db = new SqliteDatabase();
>   db.connect(sqldb);
> 
>   Row[] rows = db.queryFetchAll("SELECT * FROM sqlite_master WHERE
> type='table' AND name='LSOpenJobs'");
>   foreach (Row row; rows)
>   {
>     writefln("username: %s Project: %s\n", row["login"], row
> ["proj"]);
>   }
> 
>   db.close();
> }
> 
> ----------------
> 
> But I am getting this error,
> 
> 23:24:19.89>build -clean dbitest.d
> dbitest.d(1): module SqliteDatabase cannot read
> file 'dbi\sqlite\SqliteDatabase.d'
> 
> I tried to build dbi, and here is what I get,
> 
> 23:24:42.54>dmd -run buildme.d sqlite
> Digital Mars Librarian Version 8.00n
> Copyright (C) Digital Mars 2000-2002 All Rights Reserved
> www.digitalmars.com
> Digital Mars Librarian complete.
> 
> I took the dbi.lib and placed it on c:\dmd\lib and I get the same thing.
> 
> Any ideas as to what to do to get this above program compiled?
> 
> Thanks so much.
> 
> jos�

Hi,

I have a symlink to the dbi code so that the source can be found by the compiler.  So my dbi folder would be in the same one as the dbitest.d file. You may just want to put a copy of the code there, if you can't do symlinks. Or, get a libddbi.a or ddbi.lib somewhere and send it to the linker.

I then give build the following switches in a build.brf file that (for you)
would look like this:

dbitest
-op
-L-lsqlite
-cleanup

Then, you just type build

hth,
BA

P.S.  I still would have posted this in the ddbi forum on dsource.  I'm watching it a bit...
January 05, 2007
Brad Anderson wrote:

> I then give build the following switches in a build.brf file that (for
> you) would look like this:
> 
> dbitest
> -op
> -L-lsqlite
> -cleanup

... And add -d switch to allow depreciated features, when compiling with D 1.0. Currently DDBI is a little bit broken as implicit conversion of D char arrays to char* is depreciated....

-- 
Regards
Marcin Kuszczak (Aarti_pl)
-------------------------------------
Ask me why I believe in Jesus http://zapytaj.dlajezusa.pl (en/pl)
-------------------------------------

January 05, 2007
== Quote from Brad Anderson's article
> jicman wrote:
> > Greetings!  Congratulations to all of us for 1.0!
Woowoowoowoooooo!
> >
> > Sorry to ask about this on this newsgroup, but I am kinda trapped for time and the DBI forum on dsource.org is kinda slow and
perhaps
> > I get faster response here.  Thanks.
> >
> > Ok, so I want to compile this test program,
> >
> > ----------------
> > import dbi.sqlite.SqliteDatabase;
> > import dbi.Row;
> > //import dbi.all;
> > import std.stdio;
> >
> > void main() {
> >   char[] sqldb  = r"C:\OpenJobs.db";
> >   SqliteDatabase db = new SqliteDatabase();
> >   db.connect(sqldb);
> >
> >   Row[] rows = db.queryFetchAll("SELECT * FROM sqlite_master
WHERE
> > type='table' AND name='LSOpenJobs'");
> >   foreach (Row row; rows)
> >   {
> >     writefln("username: %s Project: %s\n", row["login"], row
> > ["proj"]);
> >   }
> >
> >   db.close();
> > }
> >
> > ----------------
> >
> > But I am getting this error,
> >
> > 23:24:19.89>build -clean dbitest.d
> > dbitest.d(1): module SqliteDatabase cannot read
> > file 'dbi\sqlite\SqliteDatabase.d'
> >
> > I tried to build dbi, and here is what I get,
> >
> > 23:24:42.54>dmd -run buildme.d sqlite
> > Digital Mars Librarian Version 8.00n
> > Copyright (C) Digital Mars 2000-2002 All Rights Reserved
> > www.digitalmars.com
> > Digital Mars Librarian complete.
> >
> > I took the dbi.lib and placed it on c:\dmd\lib and I get the same thing.
> >
> > Any ideas as to what to do to get this above program compiled?
> >
> > Thanks so much.
> >
> > jos�
> Hi,
> I have a symlink to the dbi code so that the source can be found
by the
> compiler.  So my dbi folder would be in the same one as the
dbitest.d file.
> You may just want to put a copy of the code there, if you can't do
symlinks.
> Or, get a libddbi.a or ddbi.lib somewhere and send it to the
linker.
> I then give build the following switches in a build.brf file that
(for you)
> would look like this:
> dbitest
> -op
> -L-lsqlite
> -cleanup
> Then, you just type build
> hth,
> BA
> P.S.  I still would have posted this in the ddbi forum on
dsource.  I'm
> watching it a bit...

Thanks Brad, but I did post it there.  I posted it here after 8 or so hours after the original dsource.org post.  I haven't had much luck (probably because I don't believe in it, .-)) with posts in dsource.org.  I still have an unanswered build (bud) post.  Anyway, thanks for this.  By the way, I am trying to get D into my company. I already have about 10 utilities on our group and a few others with some of our customers.  Thanks for

I have tried this with trunk 40 and dmd v1.0, but I have to go and do a little clean up on the code.  Since now, I get,

C:\cygwin\home\us319318\source\d\dbi\sqlite\SqliteDatabase.d(63):
function dbi.sqlite.imp.sqlite3_open (char*,sqlite3 **) does not
match parameter types (char[],sqlite3 **)
C:\cygwin\home\us319318\source\d\dbi\sqlite\SqliteDatabase.d(63):
Error: cannot implicitly convert expression (params) of type char[]
to char*
C:\cygwin\home\us319318\source\d\dbi\sqlite\SqliteDatabase.d(92):
function dbi.sqlite.imp.sqlite3_exec (sqlite3 *,char*,int(*)(void*,
int, char**, char**),void*,char**) does not match parameter types
(sqlite3 *,char[],void*,void*,char**)
C:\cygwin\home\us319318\source\d\dbi\sqlite\SqliteDatabase.d(92):
Error: cannot implicitly convert expression (sql) of type char[] to
char*
C:\cygwin\home\us319318\source\d\dbi\sqlite\SqliteDatabase.d(113):
function dbi.sqlite.imp.sqlite3_prepare (sqlite3
*,char*,int,sqlite3_stmt **,char**) does not match parameter types
(sqlite3 *,char[],uint,sqlite3_stmt **,char**)
C:\cygwin\home\us319318\source\d\dbi\sqlite\SqliteDatabase.d(113):
Error: cannot implicitly convert expression (sql) of type char[] to
char*

Let me go and clean those up.  I hope these get cleaned up on trunk 41. :-)

Thanks again.
January 05, 2007
== Quote from Marcin Kuszczak (aarti@interia.pl)'s article
> Brad Anderson wrote:
> > I then give build the following switches in a build.brf file
that (for
> > you) would look like this:
> >
> > dbitest
> > -op
> > -L-lsqlite
> > -cleanup
> ... And add -d switch to allow depreciated features, when
compiling with D
> 1.0. Currently DDBI is a little bit broken as implicit conversion
of D char
> arrays to char* is depreciated....

== Quote from Marcin Kuszczak (aarti@interia.pl)'s article
> Brad Anderson wrote:
> > I then give build the following switches in a build.brf file
that (for
> > you) would look like this:
> >
> > dbitest
> > -op
> > -L-lsqlite
> > -cleanup
> ... And add -d switch to allow depreciated features, when
compiling with D
> 1.0. Currently DDBI is a little bit broken as implicit conversion
of D char
> arrays to char* is depreciated....

Thanks.  This is even better. .-)