I may be misunderstanding, but is the example in the link declaring a sqlite
column of type datetime? I didn't think you could do that.

I just created a person table with four text columns and wrote this in my
playground:

|conn sql bindings|
conn := SQLite3Connection on: 'C:\Users\JeffGray\test.db'.
conn open.
sql := 'insert into person (active, created, first_name, last_name) values
("Y", ?, "Jeff", "Gray")'.
bindings := OrderedCollection new.
bindings add: DateAndTime now.
conn execute: sql with: bindings.
conn close.

Then I wrote this to pull it out:
|conn sql c rows|
conn := SQLite3Connection on: 'C:\Users\JeffGray\test.db'.
conn open.
sql := 'select created from person where rowid = 1'.
c := conn execute: sql.
row := c rows first.
(row at: 'created') inspect. 
conn close.

The object I get is a byte string. Is there any magic I can do to get a
DateAndTime or:
1. do I have to know the column is a date and call the DateAndTime
fromString:; or
2. can you make a sqlite column know it's a date (like in the example link);
or
3. is there something else I'm missing?

 



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply via email to