Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


specifying datatypes when converting table to SQLite DB


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-14-2007, 01:28 AM
Junior Member
 
Join Date: May 2007
Posts: 27
Awards Showcase
Beta Tester 
Total Awards: 1
Default specifying datatypes when converting table to SQLite DB

Hi folks,

I am looking at a means to optimize the database I will eventually use in my GPS application. The following code produces a database, but from the inflated size I think all the numeric data is being turned into UTF8 text. Is there a way to import a table into an SQLite database and specify the data types to be used? Here is what I have so far, borrowed from the very handy database conversion utility posted to this forum earlier.

table1.LoadCSV("points.csv", ";",true, true)

doevents

Con.Open("Data Source = " & AppPath & "\points.sl3")

cmd.CommandText = "DROP TABLE points"
cmd.ExecuteNonQuery

Con.CreateSQLTable ("Table1","points")

cmd.CommandText = "CREATE INDEX points_IDX1 ON points(id ASC)"
cmd.ExecuteNonQuery

cmd.CommandText = "CREATE INDEX points_IDX2 ON points(NAME ASC)"
cmd.ExecuteNonQuery

con.Close

In the short run, I know I could loop through the table and issue numerous "INSERT INTO" statements, but I suspect that with thousands of points to compile, such a process would not be very efficient. I appreciate any tips that can be offered.

- All my best,
- Steve
Reply With Quote
  #2 (permalink)  
Old 06-14-2007, 05:56 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,132
Default

You should first create the table columns using cString or cNumber, afterwards load the data using LoadCSV without recreating the columns.
That way it will save the number columns as REAL columns in the SQL db.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting date to ticks value mozaharul Questions & Help Needed 3 10-22-2008 10:51 AM
Help needed converting a VB6 Project Drewpeu Questions & Help Needed 11 10-15-2008 07:13 PM
How to combine table control and sqlite database mozaharul Questions & Help Needed 1 03-27-2008 01:10 PM
Tool to create, edit , modify table and registers in sqlite 3 tucano2000 Code Samples & Tips 0 02-12-2008 01:11 PM
Problem Converting CSV to SQLite tcgoh Questions & Help Needed 5 11-01-2007 03:50 AM


All times are GMT. The time now is 03:28 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0