Jump to page: 1 2 3
Thread overview
Problems compiling sqlite-d
Jan 27, 2017
Nestor
Jan 27, 2017
Stefan Koch
Jan 27, 2017
Stefan Koch
Jan 27, 2017
Nestor
Jan 27, 2017
Stefan Koch
Jan 28, 2017
Nestor
Jan 28, 2017
Stefan Koch
Jan 29, 2017
Nestor
Jan 29, 2017
Stefan Koch
Jan 29, 2017
Nestor
Jan 28, 2017
Adam D. Ruppe
Jan 28, 2017
Stefan Koch
Jan 29, 2017
Adam D. Ruppe
Jan 29, 2017
Nestor
Jan 29, 2017
Adam D. Ruppe
Jan 29, 2017
Nestor
Jan 29, 2017
Stefan Koch
Jan 29, 2017
Nestor
Jan 29, 2017
Stefan Koch
Jan 29, 2017
Ali Çehreli
Jan 29, 2017
Adam D. Ruppe
Jan 29, 2017
Nestor
Jan 29, 2017
Adam D. Ruppe
Jan 30, 2017
Nestor
Jan 30, 2017
Adam D. Ruppe
Jan 30, 2017
Nestor
Jan 30, 2017
Adam D. Ruppe
Jan 30, 2017
Nestor
January 27, 2017
Hi,

I was trying to use https://github.com/UplinkCoder/sqlite-d

Unfortunately even something as simple as this doesn´t compile (at least on Windows):

import std.stdio, sqlited;

void main(string[] args) {
  string filename = (args.length == 2 ? args[1] : "data.db");
  Database db = Database(filename);
}

See the error:
OPTLINK (R) for Win32  Release 8.00.17
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
z1_app.obj(z1_app)
 Error 42: Symbol Undefined _D7sqlited8Database6__initZ
z1_app.obj(z1_app)
 Error 42: Symbol Undefined _D7sqlited8Database6__ctorMFNcAyabZS7sqlited8Database
Error: linker exited with status 107814472

Is there any other native D implementation of sqlite reader?

January 27, 2017
On Friday, 27 January 2017 at 12:01:30 UTC, Nestor wrote:
> Hi,
>
> I was trying to use https://github.com/UplinkCoder/sqlite-d
>
> Unfortunately even something as simple as this doesn´t compile (at least on Windows):
>
> import std.stdio, sqlited;
>
> void main(string[] args) {
>   string filename = (args.length == 2 ? args[1] : "data.db");
>   Database db = Database(filename);
> }
>
> See the error:
> OPTLINK (R) for Win32  Release 8.00.17
> Copyright (C) Digital Mars 1989-2013  All rights reserved.
> http://www.digitalmars.com/ctg/optlink.html
> z1_app.obj(z1_app)
>  Error 42: Symbol Undefined _D7sqlited8Database6__initZ
> z1_app.obj(z1_app)
>  Error 42: Symbol Undefined _D7sqlited8Database6__ctorMFNcAyabZS7sqlited8Database
> Error: linker exited with status 107814472
>
> Is there any other native D implementation of sqlite reader?

I take it you build without dub ?
Have you specified source/sqlite.d on your compile commandline ?

January 27, 2017
On Friday, 27 January 2017 at 12:04:06 UTC, Stefan Koch wrote:
>
> I take it you build without dub ?
> Have you specified source/sqlite.d on your compile commandline ?

That was supposed to say.
sqlite-d/source/sqlited.d

Please feel free to post here or contact me directly regarding the usage of sqlite-d.


January 27, 2017
On Friday, 27 January 2017 at 12:06:33 UTC, Stefan Koch wrote:
> On Friday, 27 January 2017 at 12:04:06 UTC, Stefan Koch wrote:
>>
>> I take it you build without dub ?
>> Have you specified source/sqlite.d on your compile commandline ?
>
> That was supposed to say.
> sqlite-d/source/sqlited.d
>
> Please feel free to post here or contact me directly regarding the usage of sqlite-d.

Yes I was building withoug dub. What I did was simply:

copy data.db to sqlite-d/source
cd to sqlite-d/source
copy api_user.d to z1_app.d
modify z1_app.d (as shown before)
compile z1_app without additional parameters.

Shouldn't it work?

This was with dmd v2.072.2 on Windows 7 SP1 x86-64
January 27, 2017
On Friday, 27 January 2017 at 12:21:29 UTC, Nestor wrote:
> On Friday, 27 January 2017 at 12:06:33 UTC, Stefan Koch wrote:
>> On Friday, 27 January 2017 at 12:04:06 UTC, Stefan Koch wrote:
>>>
>>> I take it you build without dub ?
>>> Have you specified source/sqlite.d on your compile commandline ?
>>
>> That was supposed to say.
>> sqlite-d/source/sqlited.d
>>
>> Please feel free to post here or contact me directly regarding the usage of sqlite-d.
>
> Yes I was building withoug dub. What I did was simply:
>
> copy data.db to sqlite-d/source
> cd to sqlite-d/source
> copy api_user.d to z1_app.d
> modify z1_app.d (as shown before)
> compile z1_app without additional parameters.
>
> Shouldn't it work?
>
> This was with dmd v2.072.2 on Windows 7 SP1 x86-64

You have to compile the library with your app.
or better yet use dub
replace app.d with your app.d and run dub
January 28, 2017
On Friday, 27 January 2017 at 12:55:55 UTC, Stefan Koch wrote:
> You have to compile the library with your app.
> or better yet use dub
> replace app.d with your app.d and run dub

Thanks. It did compile using dub, though I had a couple of issues with dub, by the way.

The first occured because I am using a proxy which allows me to use only the browser, so I downloaded the git repository to a directory and made tests there. However finally I moved the library to the proper location, which in Windows 7 is this:

C:\Users\nestor\AppData\Roaming\dub\packages\sqlite-d-0.1.0

Now, when I tried build your default app, it complained about the path:

C:\>dub run sqlite-d
Building package sqlite-d in C:\Users\nestor\AppData\Roaming\dub\packages\sqlite-d-0.1.0\sqlite-d\
Performing "debug" build using dmd for x86.
sqlite-d ~master: building configuration "application"...
Linking...
Running .\Users\nestor\AppData\Roaming\dub\packages\sqlite-d-0.1.0\sqlite-d\sqlite-d.exe
opening file views/test-2.3.sqlite

std.file.FileException@std\file.d(358): views/test-2.3.sqlite: El sistema no puede encontrar la ruta especificada.
----------------
0x00425CC1 in @trusted bool std.file.cenforce!(bool).cenforce(bool, const(char)[], const(wchar)*, immutable(char)[], uint)
0x004074C2 in @safe void[] std.file.read!(immutable(char)[]).read(immutable(char)[], uint) at C:\dmd2\Windows\bin\..\..\src\phobos\std\file.d(228)
0x0040B947 in ref sqlited.Database sqlited.Database.__ctor(immutable(char)[], bool)
0x004022E9 in _Dmain at C:\Users\nestor\AppData\Roaming\dub\packages\sqlite-d-0.1.0\sqlite-d\source\app.d(19)
0x0041CC8B in D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv
0x0041CC4F in void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll()
0x0041CB50 in _d_run_main
0x00408644 in main at C:\Users\nestor\AppData\Roaming\dub\packages\sqlite-d-0.1.0\sqlite-d\source\api_user.d(7)
0x0045BC45 in mainCRTStartup
0x754733CA in BaseThreadInitThunk
0x77309ED2 in RtlInitializeExceptionChain
0x77309EA5 in RtlInitializeExceptionChain
Program exited with code 1

"El sistema no puede encontrar la ruta especificada" simply means "System can't find specified path"

However, it compiles correctly if I run the command from C:\Users\nestor\AppData\Roaming\dub\packages\sqlite-d-0.1.0\sqlite-d\

The second issue was perhaps related, I tried to make a new project using your library as a dependency:

{
	"name": "sqlite-test",
	"authors": [
		"Nestor Perez"
	],
	"dependencies": {
		"sqlite-d": "~>0.1.0"
	},
	"description": "Simple sqlite-d test application",
	"copyright": "Copyright (c) 2017, Nestor Perez",
	"license": "Boost"
}

However I get this error when i try to run dub:
Fetching sqlite-d 0.1.0 (getting selected version)...
Non-optional dependency sqlite-d of sqlite-test not found in dependency tree!?.

I also tried copying sqlite-d directory to source/ of my project, but same thing happens.

I confess I have no experience making new projects with dub, so if you can spare a little patience, what would be the proper way to use your library for a new project?
January 28, 2017
On Friday, 27 January 2017 at 12:01:30 UTC, Nestor wrote:
> Is there any other native D implementation of sqlite reader?

My sqlite.d and database.d from here can do it too:
https://github.com/adamdruppe/arsd

Just download those two files and compile them together with your file:

dmd yourfile.d database.d sqlite.d

However, my thing requires the C library, sqlite3, to be available already so it might not work out of the box for you either.

import arsd.sqlite;
auto db = new Sqlite("filename");
foreach(row; db.query("select * from foo"))
  writeln(row[0], row["name"]);
January 28, 2017
On Saturday, 28 January 2017 at 19:01:48 UTC, Adam D. Ruppe wrote:
> On Friday, 27 January 2017 at 12:01:30 UTC, Nestor wrote:
>> Is there any other native D implementation of sqlite reader?
>
> My sqlite.d and database.d from here can do it too:
> https://github.com/adamdruppe/arsd
>
> Just download those two files and compile them together with your file:
>
> dmd yourfile.d database.d sqlite.d
>
> However, my thing requires the C library, sqlite3, to be available already so it might not work out of the box for you either.
>
> import arsd.sqlite;
> auto db = new Sqlite("filename");
> foreach(row; db.query("select * from foo"))
>   writeln(row[0], row["name"]);

It's not native though.
January 28, 2017
On Saturday, 28 January 2017 at 12:09:35 UTC, Nestor wrote:
> On Friday, 27 January 2017 at 12:55:55 UTC, Stefan Koch wrote:
>> [...]
>
> Thanks. It did compile using dub, though I had a couple of issues with dub, by the way.
>
> [...]

I think you have to remove the app.d that comes with sqlite-d file if you want to use it.
Because that tries to open views/test-2.3.sqlite.

Please try to read the source-code in app.d and in test.d that come with sqlite-d.

If you have questions about that I am happy to answer them.
Sqlite-d is a work in progress and I have not used it for an actual project.

Currently I am busy with improving the ctfe engine.
So I don't have to many resources should sqlite-d need improvements.
January 29, 2017
On Saturday, 28 January 2017 at 21:03:08 UTC, Stefan Koch wrote:
> It's not native though.

It's a mistake to ask for native D implementations of mature C libraries, especially a public domain one like sqlite. There's just no advantage in production use to rewrite it.
« First   ‹ Prev
1 2 3