Using SQLite3?

Windows specific forum
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Using SQLite3?

Post by jassing »

I tried to use PBOSL4 to use sqlite3, but that didn't work, and was unable to recompile (tailbite errors).
I see others are using sqlite3 -- my question is what do I need to get up and going with sqlite3 in purebasic4?
User avatar
bobobo
Enthusiast
Enthusiast
Posts: 206
Joined: Mon Jun 09, 2003 8:30 am

Re: Using SQLite3?

Post by bobobo »

try to read the purebasic online help -section database :D
사십 둘 .
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Re: Using SQLite3?

Post by rsts »

jassing wrote:I tried to use PBOSL4 to use sqlite3, but that didn't work, and was unable to recompile (tailbite errors).
I see others are using sqlite3 -- my question is what do I need to get up and going with sqlite3 in purebasic4?
There are some excellent wrappers for sqlite3, if you're willing to go that route. Many of us have been doing it that way for a number of years and feel it's very solid.

Use a search - ts-soft has privided an excellent wrapper. There is quite a bit of forum support avainable for this approach also. Fangbeast could write a tutorial.

cheers
User avatar
Kiffi
Addict
Addict
Posts: 1485
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: Using SQLite3?

Post by Kiffi »

jassing wrote:my question is what do I need to get up and going with sqlite3 in purebasic4?
just type

Code: Select all

UseSQLiteDatabase()
that's all!

Greetings ... Kiffi
Hygge
User avatar
lazarusoft
User
User
Posts: 23
Joined: Wed Jan 10, 2007 10:17 pm
Location: Brasil

Re: Using SQLite3?

Post by lazarusoft »

Native PB, it's easy

Code: Select all

UseSQLiteDatabase()

ImportC ""
sqlite3_libversion()
EndImport

Debug "Sqlite3 Version: "+PeekS(sqlite3_libversion()) ; Sqlite3 Version: 3.6.23.1

  Filename$ = "C:\mydb.db3"

  If CreateFile(0, Filename$)
    Debug "Database file created OK"
    CloseFile(0)
  EndIf
  
  If OpenDatabase(0, Filename$, "", "")
      Debug "Connected to mydb.db3 OK"
     Define.s msg="blabla"
    If DatabaseUpdate(0, "CREATE TABLE info (test VARCHAR(255));")
      Debug "Table created OK"
      
      DatabaseUpdate(0, "INSERT INTO info (test) values ('"+msg+"');")

      DatabaseQuery(0, "SELECT * FROM info")
      ;Debug DatabaseError()
      
      If FirstDatabaseRow(0)
      
      Debug GetDatabaseString(0,0); get blabla
      
      FinishDatabaseQuery(0)
      EndIf
    EndIf
    CloseDatabase(0); close database
  EndIf
JAVA é como uma Ferrari, mas a diferença é que a Ferrari está em um caminhão cegonha... JAVA is like a Ferrari, but the difference is that Ferrari is in a truck stork ...
Post Reply