View previous topic :: View next topic |
Author |
Message |
gekkonier
Joined: 27 Mar 2007 Posts: 28
|
Posted: Fri Aug 10, 2007 3:32 am Post subject: Problem with sqlite example |
|
|
Hi, I'm using dmd 1.020 on Windows XP, fresh installed tango and ddbi over dsss net install ...
I try to compile this:
Code: | module sqliteconnect;
import dbi.sqlite.SqliteDatabase;
import tango.io.Stdout;
void main() {
SqliteDatabase db = new SqliteDatabase();
db.connect("test.db");
auto rows = db.queryFetchAll("SELECT * FROM names");
foreach (Row row; rows) {
Stdout("name:")(row["name"]).newline()("zip:")(row["zip"]).newline();
}
db.close();
} |
with that:
Code: | dsss build filename.d |
This is the output:
Code: |
sqliteconnect.d => sqliteconnect
+ c:\digitalmars\dmd\bin\rebuild.exe -Idsss_imports\ -I. -S.\ -Ic:\digitalmars\dmd\include\d -Sc:\digitalmars\dmd\lib\ -Ic:\digitalmars\dmd\include\d -Sc:\digitalmars\dmd\lib -oqdsss_objs sqliteconnect.d -ofsqliteconnect
sqliteconnect.d(11): Error: identifier 'Row' is not defined
sqliteconnect.d(11): Error: Row is used as a type
sqliteconnect.d(11): variable sqliteconnect.main.row voids have no value
sqliteconnect.d(12): Error: row must be an array or pointer type, not int
sqliteconnect.d(12): Error: row must be an array or pointer type, not int
sqliteconnect.d(11): Error: foreach: Row[] is not an array of int
Command c:\digitalmars\dmd\bin\rebuild.exe returned with code 1, aborting. |
Any clue how I can fix this?
Where is Row defined?
Thanks, Gekkonier |
|
Back to top |
|
|
gekkonier
Joined: 27 Mar 2007 Posts: 28
|
Posted: Fri Aug 10, 2007 4:02 am Post subject: |
|
|
Okay, I figured Row out:
Code: | module sqliteconnect;
import dbi.sqlite.SqliteDatabase;
import dbi.Row;
import tango.io.Console;
void main() {
SqliteDatabase db = new SqliteDatabase();
db.connect("test.db");
Row[] rows = db.queryFetchAll("SELECT * FROM names");
foreach (Row row; rows) {
Cout("name:")(row["name"]).newline()("zip:")(row["zip"]).newline();
}
db.close();
}
|
but it produces:
Code: |
sqliteconnect.d => sqliteconnect
+ c:\digitalmars\dmd\bin\rebuild.exe -Idsss_imports\ -I. -S.\
-Ic:\digitalmars\dmd\include\d -Sc:\digitalmars\dmd\lib\
-Ic:\digitalmars\dmd\include\d -Sc:\digitalmars\dmd\lib -oqdsss_objs sqliteconnect.d -ofsqliteconnect
c:\digitalmars\dmd\bin\..\..\dm\bin\link.exe dsss_objs\_sqliteconnect+dsss_objs\tango-stdc-stringz
+dsss_objs\tango-text-Util+dsss_objs\tango-core-Vararg
+dsss_objs\tango-text-Regex+dsss_objs\tango-stdc-string
+dsss_objs\tango-stdc-stddef+dsss_objs\tango-stdc-stdio
+dsss_objs\tango-stdc-stdarg+dsss_objs\tango-stdc-config
+dsss_objs\tango-stdc-ctype+dsss_objs\tango-stdc-stdlib
+dsss_objs\tango-core-BitArray+dsss_objs\tango-io-Console
+dsss_objs\tango-sys-Common+dsss_objs\tango-io-Buffer
+dsss_objs\tango-io-model-IBuffer
+dsss_objs\tango-io-model-IConduit
+dsss_objs\tango-io-DeviceConduit
+dsss_objs\tango-io-Conduit,sqliteconnect,,user32+kernel32/noi
+SDD-dbi-sqlite.lib+SDD-dbi.lib+.\\+c:\digitalmars\dmd\lib\\
+c:\digitalmars\dmd\lib\+tango.lib+tango.lib;
OPTLINK (R) for Win32 Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved
c:\digitalmars\dmd\lib\\SDD-dbi-sqlite.lib(SqliteDatabase)
Error 42: Symbol Undefined _sqlite3_open
c:\digitalmars\dmd\lib\\SDD-dbi-sqlite.lib(SqliteDatabase)
Error 42: Symbol Undefined _sqlite3_close
c:\digitalmars\dmd\lib\\SDD-dbi-sqlite.lib(SqliteDatabase)
Error 42: Symbol Undefined _sqlite3_errmsg
c:\digitalmars\dmd\lib\\SDD-dbi-sqlite.lib(SqliteDatabase)
Error 42: Symbol Undefined _sqlite3_exec
c:\digitalmars\dmd\lib\\SDD-dbi-sqlite.lib(SqliteDatabase)
Error 42: Symbol Undefined _sqlite3_prepare
c:\digitalmars\dmd\lib\\SDD-dbi-sqlite.lib(SqliteDatabase)
Error 42: Symbol Undefined _sqlite3_errcode
c:\digitalmars\dmd\lib\\SDD-dbi-sqlite.lib(SqliteDatabase)
Error 42: Symbol Undefined _sqlite3_last_insert_rowid
c:\digitalmars\dmd\lib\\SDD-dbi-sqlite.lib(SqliteDatabase)
Error 42: Symbol Undefined _sqlite3_changes
c:\digitalmars\dmd\lib\\SDD-dbi-sqlite.lib(SqliteResult)
Error 42: Symbol Undefined _sqlite3_step
c:\digitalmars\dmd\lib\\SDD-dbi-sqlite.lib(SqliteResult)
Error 42: Symbol Undefined _sqlite3_column_count
c:\digitalmars\dmd\lib\\SDD-dbi-sqlite.lib(SqliteResult)
Error 42: Symbol Undefined _sqlite3_column_name
c:\digitalmars\dmd\lib\\SDD-dbi-sqlite.lib(SqliteResult)
Error 42: Symbol Undefined _sqlite3_column_text
c:\digitalmars\dmd\lib\\SDD-dbi-sqlite.lib(SqliteResult)
Error 42: Symbol Undefined _sqlite3_column_decltype
c:\digitalmars\dmd\lib\\SDD-dbi-sqlite.lib(SqliteResult)
Error 42: Symbol Undefined _sqlite3_column_type
c:\digitalmars\dmd\lib\\SDD-dbi-sqlite.lib(SqliteResult)
Error 42: Symbol Undefined _sqlite3_finalize
--- errorlevel 15
Command c:\digitalmars\dmd\bin\rebuild.exe returned with code -1, aborting.
|
|
|
Back to top |
|
|
gekkonier
Joined: 27 Mar 2007 Posts: 28
|
Posted: Fri Aug 10, 2007 9:41 am Post subject: |
|
|
figured it out:
create with implib out of sqlite3.dll a lib file and link with it.
you need a dsss.conf file with this:
[myfilewhichusesddbi.d]
buildflags=sqlite3.lib
then you can bake with that:
dsss build |
|
Back to top |
|
|
|