How to compile this (sqlite sample)

Moderator: Rathinagiri

Post Reply
User avatar
Clip2Mania
Posts: 99
Joined: Fri Jun 13, 2014 7:16 am
Location: Belgium

How to compile this (sqlite sample)

Post by Clip2Mania »

Hi all,
I'm trying to compile the example attached (it's about sqlite) in HMG, but I can't get it working.
I keep on getting 'undefined reference to `sqlite3_xxxxx' errors :?

What should I do to make these errors go away?

Thanks,
Erik
Attachments
sqlite.rar
(41.95 KiB) Downloaded 466 times
pdhana
Posts: 9
Joined: Fri Jan 24, 2014 5:26 pm

Re: How to compile this (sqlite sample)

Post by pdhana »

Hi,

I could able to compile successfully. However there is an argument error which you may need to correct.


C:\hmg.3.3.0\SAMPLES\Projs\sqlite>type build.bat
@echo ON
cls
SETLOCAL
SET temp=%~dp0
SET stemp=%temp%&SET pos=0

:loop
SET /a pos+=1
echo %stemp%|FINDSTR /b /c:"SAMPLES" >NUL
IF ERRORLEVEL 1 (
SET stemp=%stemp:~1%
IF DEFINED stemp GOTO loop
SET pos=0
)

setlocal enableDelayedExpansion
set "temp1=%temp%"
set /a pos=pos-2

set temp=!temp1:~0,%pos%!

if "%1"=="" Goto WithOutPar
Set MainFile=%1
Goto Continue
:WithOutPar
for /R %~dp0%~1 %%f in (*.hbp) do (Set MainFile="%%~nf")
Goto Continue
:Continue


call %temp%\build.bat %MainFile%
Attachments
screen.png
screen.png (8.82 KiB) Viewed 9920 times
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: How to compile this (sqlite sample)

Post by Rathinagiri »

In your .hbc file, you have to include

libs=sqlite3
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Clip2Mania
Posts: 99
Joined: Fri Jun 13, 2014 7:16 am
Location: Belgium

Re: How to compile this (sqlite sample)

Post by Clip2Mania »

In your .hbc file, you have to include

libs=sqlite3
That's what I was missing. Thought it was some lib-thing, but didn't know where to put it! :)
Thanks, Mr. Rathinagiri!
Erik
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: How to compile this (sqlite sample)

Post by bpd2000 »

Clip2Mania wrote:
In your .hbc file, you have to include

libs=sqlite3
That's what I was missing. Thought it was some lib-thing, but didn't know where to put it! :)
Thanks, Mr. Rathinagiri!
Erik
Add in hmg.hbc file located at c:\hmg\hmg.hbc
BPD
Convert Dream into Reality through HMG
User avatar
Clip2Mania
Posts: 99
Joined: Fri Jun 13, 2014 7:16 am
Location: Belgium

Re: How to compile this (sqlite sample)

Post by Clip2Mania »

Add in hmg.hbc file located at c:\hmg\hmg.hbc
It happened to be the only lib which was "remmed out" (#) in hmg 3.3.1 (don't know why)

However, I still get following error (apparently cannot create the database)

I am using HMG 3.3.1 - 32 bits.
Should I recompile harbour or so?
Attachments
sqlite_err.jpg
sqlite_err.jpg (58.2 KiB) Viewed 9797 times
User avatar
gfilatov
Posts: 1057
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: How to compile this (sqlite sample)

Post by gfilatov »

Clip2Mania wrote: However, I still get following error (apparently cannot create the database)

I am using HMG 3.3.1 - 32 bits.
Should I recompile harbour or so?
Hi,

No, it is not :?
There is a mistake in your calling the function MiscSql() - wrong a first parameter.

Please take a look for your updated module main_button_1_action.prg below:

Code: Select all

#include "hmg.ch"

declare window Main

Function main_button_1_action
public dbo := nil

if .not. file("nombre.db3")
   crearbase("nombre.db3")
   msginfo("BASE Creada")
   return nil
else
  dbo := connect2db("nombre.db3",.f.)
   If dbo == nil
       msginfo("no se puede conectar con la Base")
      return nil
   Endif
endif   

if ! iswindowactive(vnombre)
   Load Window vnombre

   datossqlite()

   vnombre.Center
   vnombre.Activate
endif
Return Nil


function crearbase(mDb)
  local sQry

  dbo := connect2db(mDb,.t.)
  if dbo == nil
     msgstop("File could not be created!")
     return nil
  endif
      
  // create table
  sQry := 'CREATE TABLE IF NOT EXISTS "personales" ("id" INTEGER PRIMARY KEY, "nombre" VARCHAR(55), "telefono" VARCHAR(15), "fecha" DATE);'  
  MiscSql(dbo, sQry)
return nil 
The program will work smoothly after above update 8-)
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: How to compile this (sqlite sample)

Post by mustafa »

Hello Clip2Mania
Look at the Post:

viewtopic.php?f=6&t=1558&start=10" onclick="window.open(this.href);return false;
Sample_Sqlite.zip

Regards

Mustafa
User avatar
Clip2Mania
Posts: 99
Joined: Fri Jun 13, 2014 7:16 am
Location: Belgium

Re: How to compile this (sqlite sample)

Post by Clip2Mania »

Thanks Mustafa!

Problem is, I once downloaded this (nice) example, but wasn't aware of the updates :oops:
Thanks for helping me out! All works now.

Erik
Post Reply