Re: [fpc-pascal] Postgresql interface bronken for Raspberry pi model 1b
On 2016-04-02 20:29, Bo Berglund wrote: > On Mon, 28 Mar 2016 15:30:36 +0200, Björn Lundin > wrote: > >> That speaks for trying to compile 3.0.0. >> The pi is on wheezy, so there is no .deb package >> for it. > > I made a script for installing FPV 3.0.0 and Lazarus 1.6 release on an > RPi. > http://blog.boberglund.com/install_laz_pi.sh > > You can have a look at it and strip off Lazarus if you like. > It is not very difficult to build FPC from sources really... > One caveat with wheezy and some Pi versions is that you should up swap > to 1000 to not get caught in the linker. > Swap expansion is found in sudo raspi-config. Yes, I saw that link somewhere else. I got 2 pi:s, one original B with 256 mb and one later B model with 512 mb RAM. I downloaded and ran it 'as is'. The pi:s do have 1Bb each of swap, but both froze during compilation. Both are on rasbian wheezy. I'll strip away lazarus as you say and try again. If I don't get it to work, I'll look into cross compiling from win32 to the pi -- Björn ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Postgresql interface bronken for Raspberry pi model 1b
On Mon, 28 Mar 2016 15:30:36 +0200, Björn Lundin wrote: >That speaks for trying to compile 3.0.0. >The pi is on wheezy, so there is no .deb package >for it. I made a script for installing FPV 3.0.0 and Lazarus 1.6 release on an RPi. http://blog.boberglund.com/install_laz_pi.sh You can have a look at it and strip off Lazarus if you like. It is not very difficult to build FPC from sources really... One caveat with wheezy and some Pi versions is that you should up swap to 1000 to not get caught in the linker. Swap expansion is found in sudo raspi-config. -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Postgresql interface bronken for Raspberry pi model 1b
On 2016-03-28 15:02, Marco van de Voort wrote: > There are like 250+ database fixes since 2.6.0. That speaks for trying to compile 3.0.0. The pi is on wheezy, so there is no .deb package for it. Thanks -- Björn ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Postgresql interface bronken for Raspberry pi model 1b
On 2016-03-28 13:45, Michael Van Canneyt wrote: > I don't think the problem is in the SQLDB code, it is CPU-agnostic. Hmm, real strange I chagne the code like this Q2 := CreateQuery(T) ; sSql := 'insert into TEST values (:INT, :FT, :DT)'; Q2.SQL.Text := sSql; Q2.Prepare; Q2.Params.ParamByName('INT').AsInteger := 1; Q2.Params.ParamByName('FT').AsFloat := 2.3; Q2.Params.ParamByName('DT').AsString := '2016-03-23 12:12:12.123'; Q2.ExecSql; and I get An unhandled exception occurred at $00030200 : EDatabaseError : : Unknown fieldtype for parameter "INT". that is, it has nothing to do with timestamps. On the ame machine a pythön script is runnig, quering the same database, with no problem. So I _think_ the client installation of pg is ok. pi@raspberrypi ~/svn/bnlbot/botstart/bot-1-0/source/pascal $ ls -la /usr/lib/libpq.so lrwxrwxrwx 1 root root 12 May 31 2015 /usr/lib/libpq.so -> libpq.so.5.4 However, I'm not sure how to proceed. Perhaps use fpc 3.0, that is download and compile it ? I'll see if I find some intructions online for doing that. -- -- Björn ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Postgresql interface bronken for Raspberry pi model 1b
In our previous episode, Michael Van Canneyt said: > > Changing the line to > > > > Q2.Params.ParamByName('DT').AsDateTime := now; > > I don't think the problem is in the SQLDB code, it is CPU-agnostic. There are like 250+ database fixes since 2.6.0. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Postgresql interface bronken for Raspberry pi model 1b
On 2016-03-28 13:45, Michael Van Canneyt wrote: > > I don't think the problem is in the SQLDB code, it is CPU-agnostic. > Hmm, ok. I'm looking at the sqldb code, and I'll need some time to digest it. Meanwhile, I think I'll try using the PQConnection unit directly, to see if I get the same result there. But it will most likely not be before next weekend. -- Björn ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Postgresql interface bronken for Raspberry pi model 1b
On Mon, 28 Mar 2016, Björn Lundin wrote: On 2016-03-28 10:27, Michael Van Canneyt wrote: On Mon, 28 Mar 2016, Björn Lundin wrote: However I'm running into trouble on timestamps fields on the pi. [snip] Q2.Prepare; //Q2.Params.ParamByName('DT').DataType := ftDateTime; Q2.Params.ParamByName('DT').Value := now;
Re: [fpc-pascal] Postgresql interface bronken for Raspberry pi model 1b
On 2016-03-28 10:27, Michael Van Canneyt wrote: > > > On Mon, 28 Mar 2016, Björn Lundin wrote: >> However I'm running into trouble on timestamps fields on the pi. > > [snip] > >> Q2.Prepare; >> //Q2.Params.ParamByName('DT').DataType := ftDateTime; >> Q2.Params.ParamByName('DT').Value := now;> Q2.ExecSql; > > Don't use Value for parameters. > > Always use .AsDateTime or whatever the actual type is supposed to be. > > Michael. > Thanks for the reply. Unfortuantly, it does not help. Changing the line to Q2.Params.ParamByName('DT').AsDateTime := now; works on win7/32 bit C:\\pascal\pg_test_float>test_float.exe A: 1 B: 1.E+000 C: 4.2457521073587959E+004 round(B): 1 round(C): 42458 but not on the pi. pi@raspberrypi ~$ ./test_float An unhandled exception occurred at $0003028C : EDatabaseError : : Unknown fieldtype for parameter "DT". $0003028C $0001C488 $00020DA0 $8750 pi@raspberrypi ~$ addr2line -e ./test_float 0003028C 0001C488 00020DA0 8750 /home/pi/svn/bnlbot/botstart/bot-1-0/source/pascal/test_float.lpr:85 /home/pi/svn/bnlbot/botstart/bot-1-0/source/pascal/test_float.lpr:85 /home/pi/svn/bnlbot/botstart/bot-1-0/source/pascal/test_float.lpr:85 /home/pi/svn/bnlbot/botstart/bot-1-0/source/pascal/test_float.lpr:57 where 57 is the line I changed -- -- Björn ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Postgresql interface bronken for Raspberry pi model 1b
On Mon, 28 Mar 2016, Björn Lundin wrote: Hi! I'm using a pi as a monitor for some process, so I'm trying to get SDL2 and a working postgres interface on it. However I'm running into trouble on timestamps fields on the pi. [snip] Q2.Prepare; //Q2.Params.ParamByName('DT').DataType := ftDateTime; Q2.Params.ParamByName('DT').Value := now;
[fpc-pascal] Postgresql interface bronken for Raspberry pi model 1b
Hi! I'm using a pi as a monitor for some process, so I'm trying to get SDL2 and a working postgres interface on it. However I'm running into trouble on timestamps fields on the pi. I wrote a console program on Win7, using 32-bit compiler bundled with Lazarus 1.6. (I think is is fpc 3.0.0) and that platform can connect to the db, and run the program. C:\pascal\pg_test_float>test_float.exe A: 1 B: 1.E+000 C: 4.2457016203831023E+004 round(B): 1 round(C): 42457 The same program on the pi crashes. pi@raspberrypi ~ $ fpc -v Free Pascal Compiler version 2.6.0-9+rpi1+wsf1 [2015/04/28] for arm Copyright (c) 1993-2011 by Florian Klaempfl and others pi@raspberrypi ~ $ uname -a Linux raspberrypi 4.1.7+ #817 PREEMPT Sat Sep 19 15:25:36 BST 2015 armv6l GNU/Linux pi@raspberrypi ~/svn/bnlbot/botstart/bot-1-0/source/pascal $ ./test_float An unhandled exception occurred at $000302D4 : EDatabaseError : : Unknown fieldtype for parameter "DT". $000302D4 $0001C4D0 $00020DE8 $8760 pi@raspberrypi ~/svn/bnlbot/botstart/bot-1-0/source/pascal $ addr2line -e test_float 000302D4 0001C4D0 00020DE8 8760 /home/pi/svn/bnlbot/botstart/bot-1-0/source/pascal/test_float.lpr:85 /home/pi/svn/bnlbot/botstart/bot-1-0/source/pascal/test_float.lpr:85 /home/pi/svn/bnlbot/botstart/bot-1-0/source/pascal/test_float.lpr:85 /home/pi/svn/bnlbot/botstart/bot-1-0/source/pascal/test_float.lpr:57 where line 57 is market < here in code below ie. Q2.Params.ParamByName('DT').Value := now; program test_float; uses pqconnection,sqldb,sysutils,db; function CreateConnection: TPQConnection; begin result := TPQConnection.Create(nil); result.Hostname := 'db.somewhwew.com'; result.DatabaseName := 'asd'; result.UserName := 'asd'; result.Password := 'pwd'; end; function CreateTransaction(pConnection: TPQConnection): TSQLTransaction; begin result := TSQLTransaction.Create(pConnection); result.Database := pConnection; end; function CreateQuery(pTransaction: TSQLTransaction): TSQLQuery; begin result := TSQLQuery.Create(pTransaction.Database); result.Database := pTransaction.Database; result.Transaction := pTransaction end; var PQConn : TPQConnection; T : TSQLTransaction; Q1, Q2, Q3 : TSQLQuery; A : LongInt; B : Double; C : TDateTime; sSql : String; begin PQConn := CreateConnection ; PQConn.Open; T := CreateTransaction(PQConn); T.StartTransaction; Q1 := CreateQuery(T) ; sSql := 'create table TEST ( '; sSql += 'A integer not null primary key, '; sSql += 'B numeric(8,3) not null , '; sSql += 'C timestamp(3) without time zone not null ) '; Q1.SQL.Text := sSql; Q1.ExecSql; Q2 := CreateQuery(T) ; sSql := 'insert into TEST values (1, 1.0, :DT)'; Q2.SQL.Text := sSql; Q2.Prepare; //Q2.Params.ParamByName('DT').DataType := ftDateTime; Q2.Params.ParamByName('DT').Value := now;