Need example of usage DerelictPQ

2014-12-24 Thread Suliman via Digitalmars-d-learn
Could anybody provide any simple examples of usage DerelictPQ. I do not have experience of C, and I can't understand how to use this driver. I need just basics like connect, select and insert. http://code.dlang.org/packages/derelict-pq thanks!

Re: Need example of usage DerelictPQ

2018-03-21 Thread number via Digitalmars-d-learn
On Wednesday, 24 December 2014 at 11:56:40 UTC, Suliman wrote: Could anybody provide any simple examples of usage DerelictPQ. I do not have experience of C, and I can't understand how to use this driver. I need just basics like connect, select and insert. http://code.dlang.org/packages/dereli

Re: Need example of usage DerelictPQ

2014-12-24 Thread Suliman via Digitalmars-d-learn
I have done next: string connString = "psql -h localhost -p 5432 -U postgres -d testdb"; package PGconn* conn; @property bool nonBlocking(){ return PQisnonblocking(conn) == 1; } this(parseConfig parseconfig) { void connect() {

Re: Need example of usage DerelictPQ

2014-12-24 Thread Adam D. Ruppe via Digitalmars-d-learn
I haven't used the derelict version but I have used the C library itself and wrapped it briefly in my postgres.d here: https://github.com/adamdruppe/arsd/blob/master/postgres.d (implements an interface from database.d in the same repo) I used very, very little of the library, but it is enoug

Re: Need example of usage DerelictPQ

2014-12-24 Thread Suliman via Digitalmars-d-learn
On Wednesday, 24 December 2014 at 14:08:53 UTC, Adam D. Ruppe wrote: I haven't used the derelict version but I have used the C library itself and wrapped it briefly in my postgres.d here: https://github.com/adamdruppe/arsd/blob/master/postgres.d Thanks! But few questions: 1. how to build it w

Re: Need example of usage DerelictPQ

2014-12-24 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 24 December 2014 at 19:26:11 UTC, Suliman wrote: 1. how to build it with dub? I don't know, I don't use dub. 2. I tried to: dmd app.d database.d postgres.d but get message that "File Not Found pq.lib" Download the lib file from me here: http://arsdnet.net/dcode/pq.lib You'l

Re: Need example of usage DerelictPQ

2014-12-24 Thread Mike Parker via Digitalmars-d-learn
On 12/24/2014 8:56 PM, Suliman wrote: Could anybody provide any simple examples of usage DerelictPQ. I do not have experience of C, and I can't understand how to use this driver. I need just basics like connect, select and insert. http://code.dlang.org/packages/derelict-pq thanks! DerelictPQ

Re: Need example of usage DerelictPQ

2014-12-24 Thread Mike Parker via Digitalmars-d-learn
On 12/25/2014 11:23 AM, Mike Parker wrote: On 12/24/2014 8:56 PM, Suliman wrote: Could anybody provide any simple examples of usage DerelictPQ. I do not have experience of C, and I can't understand how to use this driver. I need just basics like connect, select and insert. http://code.dlang.or

Re: Need example of usage DerelictPQ

2014-12-24 Thread Suliman via Digitalmars-d-learn
DerelictPQ is only a binding to libpq. The only difference is the DerelictPQ.load method. Just follow the libpq documentation. http://www.postgresql.org/docs/9.1/static/libpq.html Actually, Derelict binds to version 9.3, so the proper link should be http://www.postgresql.org/docs/9.3/static

Re: Need example of usage DerelictPQ

2014-12-25 Thread Mike Parker via Digitalmars-d-learn
On 12/25/2014 3:03 PM, Suliman wrote: DerelictPQ is only a binding to libpq. The only difference is the DerelictPQ.load method. Just follow the libpq documentation. http://www.postgresql.org/docs/9.1/static/libpq.html Actually, Derelict binds to version 9.3, so the proper link should be http:

Re: Need example of usage DerelictPQ

2014-12-28 Thread Suliman via Digitalmars-d-learn
Adam, I trying to build simple app: import std.stdio; import postgres; import database; void main() { auto db = new PostgreSql("dbname = test2"); foreach(line; db.query("SELECT * FROM customer")) { writeln(line[0], line["customer_id"]); } } and getting n

Re: Need example of usage DerelictPQ

2014-12-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 28 December 2014 at 08:41:15 UTC, Suliman wrote: import postgres; import database; Those should include the package name: import arsd.postgres; Since it publicly imports the base clas, you don't need to import database yourself. (You do still need to pass all files to dmd though,