Jump to page: 1 2 3
Thread overview
question on dub and postgresql
Oct 05, 2020
Alaindevos
Oct 05, 2020
Alaindevos
Oct 05, 2020
Imperatorn
Oct 05, 2020
Alaindevos
Oct 05, 2020
Alaindevos
Oct 05, 2020
Alaindevos
Oct 05, 2020
Imperatorn
Oct 05, 2020
Alaindevos
Oct 05, 2020
Alaindevos
Oct 05, 2020
Alaindevos
Oct 05, 2020
Alaindevos
Oct 05, 2020
Alaindevos
Oct 05, 2020
Mike Parker
Oct 05, 2020
Denis Feklushkin
Oct 05, 2020
Alaindevos
Oct 06, 2020
James Blachly
Oct 05, 2020
Imperatorn
Oct 05, 2020
Daniel Kozak
Oct 05, 2020
Alaindevos
Oct 05, 2020
drug
Oct 05, 2020
Mike Parker
Oct 05, 2020
Alaindevos
Oct 07, 2020
aberba
Oct 07, 2020
H. S. Teoh
Oct 08, 2020
ddcovery
Oct 08, 2020
Alaindevos
October 05, 2020
Can I say python has pip, ruby has bundle and D has dub.
Meaning they perform the same function ?
Or am I wrong?

As I use unix the parameters for include and library are a real pain.
I have totally no idea how to connect to a postgresql database.
Where and how do I start to connect to a postgresql database ?
I write a .d program to connect.
But then I need to include the database-connection-library.d file.
Where do I place it ?
And link a database-connection. object file.
How is it installed ? There is a only a git i can clone ?
Do I need to create and edit a specific dub json config file ?
It is very unclear how to start.

[Cfr. in python it is just a "pip install postgres". And you're fine ]
Thanks for any info.
October 05, 2020
On Monday, 5 October 2020 at 08:24:26 UTC, Alaindevos wrote:
> Can I say python has pip, ruby has bundle and D has dub.
> Meaning they perform the same function ?
> Or am I wrong?
>
> As I use unix the parameters for include and library are a real pain.
> I have totally no idea how to connect to a postgresql database.
> Where and how do I start to connect to a postgresql database ?
> I write a .d program to connect.
> But then I need to include the database-connection-library.d file.
> Where do I place it ?
> And link a database-connection. object file.
> How is it installed ? There is a only a git i can clone ?
> Do I need to create and edit a specific dub json config file ?
> It is very unclear how to start.
>
> [Cfr. in python it is just a "pip install postgres". And you're fine ]
> Thanks for any info.
Some additional question, i struggle with.
Do i run dub make dub install on git clone ?
Or make , make install ?
Or it depends on the package provider ?
What for vibe ?
Which postgresql implementation is best for retreving query results record by record ?


October 05, 2020
On Monday, 5 October 2020 at 08:24:26 UTC, Alaindevos wrote:
> Can I say python has pip, ruby has bundle and D has dub.
> Meaning they perform the same function ?
> Or am I wrong?
>
> As I use unix the parameters for include and library are a real pain.
> I have totally no idea how to connect to a postgresql database.
> Where and how do I start to connect to a postgresql database ?
> I write a .d program to connect.
> But then I need to include the database-connection-library.d file.
> Where do I place it ?
> And link a database-connection. object file.
> How is it installed ? There is a only a git i can clone ?
> Do I need to create and edit a specific dub json config file ?
> It is very unclear how to start.
>
> [Cfr. in python it is just a "pip install postgres". And you're fine ]
> Thanks for any info.

Take a look at:
https://code.dlang.org/packages/dpq2
https://code.dlang.org/packages/ddbc

October 05, 2020
On Monday, 5 October 2020 at 08:34:37 UTC, Imperatorn wrote:
> On Monday, 5 October 2020 at 08:24:26 UTC, Alaindevos wrote:
>> [...]
>
> Take a look at:
> https://code.dlang.org/packages/dpq2
> https://code.dlang.org/packages/ddbc

Say I want to use dpq2.
Do I need to clone the git repository with "git clone ?"
October 05, 2020
On Monday, 5 October 2020 at 08:47:45 UTC, Alaindevos wrote:
> On Monday, 5 October 2020 at 08:34:37 UTC, Imperatorn wrote:
>> On Monday, 5 October 2020 at 08:24:26 UTC, Alaindevos wrote:
>>> [...]
>>
>> Take a look at:
>> https://code.dlang.org/packages/dpq2
>> https://code.dlang.org/packages/ddbc
>
> Say I want to use dpq2.
> Do I need to clone the git repository with "git clone ?"

rdmd is as expected unaware of includes and libraries needed.

rdmd --build-only test.d
test.d(3): Error: module `dpq2` is in file 'dpq2.d' which cannot be read
import path[0] = .
import path[1] = /usr/local/include/d
Failed: ["/usr/local/bin/ldmd2", "-v", "-o-", "test.d", "-I."]

October 05, 2020
On Mon, Oct 5, 2020 at 10:25 AM Alaindevos via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote:

> Can I say python has pip, ruby has bundle and D has dub.
> Meaning they perform the same function ?
> Or am I wrong?
>

Yes and no. Dub is Dlang dependency solution but it is not installer as pip is


>
> As I use unix the parameters for include and library are a real
> pain.
> I have totally no idea how to connect to a postgresql database.
> Where and how do I start to connect to a postgresql database ?
> I write a .d program to connect.
> But then I need to include the database-connection-library.d file.
> Where do I place it ?
> And link a database-connection. object file.
> How is it installed ? There is a only a git i can clone ?
> Do I need to create and edit a specific dub json config file ?
> It is very unclear how to start.
>

Yes if you want to use any of dub packages you need to add it as a dependency to your dub.json (dub.sdl)


October 05, 2020
On Monday, 5 October 2020 at 08:50:53 UTC, Alaindevos wrote:
> On Monday, 5 October 2020 at 08:47:45 UTC, Alaindevos wrote:
>> On Monday, 5 October 2020 at 08:34:37 UTC, Imperatorn wrote:
>>> On Monday, 5 October 2020 at 08:24:26 UTC, Alaindevos wrote:
>>>> [...]
>>>
>>> Take a look at:
>>> https://code.dlang.org/packages/dpq2
>>> https://code.dlang.org/packages/ddbc
>>
>> Say I want to use dpq2.
>> Do I need to clone the git repository with "git clone ?"
>
> rdmd is as expected unaware of includes and libraries needed.
>
> rdmd --build-only test.d
> test.d(3): Error: module `dpq2` is in file 'dpq2.d' which cannot be read
> import path[0] = .
> import path[1] = /usr/local/include/d
> Failed: ["/usr/local/bin/ldmd2", "-v", "-o-", "test.d", "-I."]

I cloned the git repository with ,running make does nothing. There is no makefile.

Dub build spits out,
dub build                                                                                      (git)-[master]-
Main package must not have target type "sourceLibrary". Cannot build.


October 05, 2020
On Monday, 5 October 2020 at 08:54:39 UTC, Daniel Kozak wrote:
> On Mon, Oct 5, 2020 at 10:25 AM Alaindevos via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote:
>
>> Can I say python has pip, ruby has bundle and D has dub.
>> Meaning they perform the same function ?
>> Or am I wrong?
>>
>
> Yes and no. Dub is Dlang dependency solution but it is not installer as pip is
>
>
>>
>> As I use unix the parameters for include and library are a real
>> pain.
>> I have totally no idea how to connect to a postgresql database.
>> Where and how do I start to connect to a postgresql database ?
>> I write a .d program to connect.
>> But then I need to include the database-connection-library.d file.
>> Where do I place it ?
>> And link a database-connection. object file.
>> How is it installed ? There is a only a git i can clone ?
>> Do I need to create and edit a specific dub json config file ?
>> It is very unclear how to start.
>>
>
> Yes if you want to use any of dub packages you need to add it as a dependency to your dub.json (dub.sdl)

A name dependency solution is at least vage.
How do I install ,
https://github.com/denizzzka/dpq2
on unix so in the code i write the .d files of that library and after compilation linked to the libary shared objects. For that shared object must be installed. How ?
October 05, 2020
On 10/5/20 12:05 PM, Alaindevos wrote:
> On Monday, 5 October 2020 at 08:54:39 UTC, Daniel Kozak wrote:
>> On Mon, Oct 5, 2020 at 10:25 AM Alaindevos via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote:
>>
>>> Can I say python has pip, ruby has bundle and D has dub.
>>> Meaning they perform the same function ?
>>> Or am I wrong?
>>>
>>
>> Yes and no. Dub is Dlang dependency solution but it is not installer as pip is
>>
>>
>>>
>>> As I use unix the parameters for include and library are a real
>>> pain.
>>> I have totally no idea how to connect to a postgresql database.
>>> Where and how do I start to connect to a postgresql database ?
>>> I write a .d program to connect.
>>> But then I need to include the database-connection-library.d file.
>>> Where do I place it ?
>>> And link a database-connection. object file.
>>> How is it installed ? There is a only a git i can clone ?
>>> Do I need to create and edit a specific dub json config file ?
>>> It is very unclear how to start.
>>>
>>
>> Yes if you want to use any of dub packages you need to add it as a dependency to your dub.json (dub.sdl)
> 
> A name dependency solution is at least vage.
> How do I install ,
> https://github.com/denizzzka/dpq2
> on unix so in the code i write the .d files of that library and after compilation linked to the libary shared objects. For that shared object must be installed. How ?

Take a look at https://code.dlang.org/packages/dpq2
This is how packages work in D
To add dpq2 dependency to your project you need to execute the command:
```
dub add dpq2
```
it adds the last version of the dpq2 package. After this you are able to use this package in your project just import it in your source files.
October 05, 2020
On Monday, 5 October 2020 at 09:05:16 UTC, Alaindevos wrote:

> A name dependency solution is at least vage.
> How do I install ,
> https://github.com/denizzzka/dpq2
> on unix so in the code i write the .d files of that library and after compilation linked to the libary shared objects. For that shared object must be installed. How ?

You don't need to install dpq2 if you are using dub to build your project. Add it as a dependency to your dub.json (or dub.sdl if you prefer that format). When you build your project, dub will download the version you configured as your dependency and compile it along with your project.

In your project root directory (where your dub.json/sdl is located), you should be able to run `dub add dpq2` and dub will add the dependency to your configuration. Or you can add it manually.

For dub.json:

"dependencies": {
    "dpq2": "~>1.0.17"
}

For dub.sdl:

dependency "dpq2" version="~>1.0.17"

Make sure libpq is installed on your system and you should be good to go.

See:
https://code.dlang.org/packages/dpq2
https://dub.pm/package-format-json
https://dub.pm/package-format-sdl

If you aren't using dub to build your project, then you could potentially use `dub install dpq2` and it will install it in a cache folder which, IIRC, should be in ~/.dub. However, I would use `git clone` or `dub fetch` so that you can keep it in a specific folder. I have some instructions for using my old Derelict packages when you aren't using dub for your project. You can adapt that to dpq2:

http://derelictorg.github.io/building/without-dub/

Once you've pulled down dpq2, you'll need to build it, then when building your project you'll have to pass the dpq source path to the compiler (with the -Ipath) so it can find the imports, the path to the dpq library you built (with -L-Lpath), and the dpq library (-L-ldpq).
« First   ‹ Prev
1 2 3