2013-07-03 03:49:29 +00:00
|
|
|
// Copyright 2013 The XORM Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// Package xorm provides is a simple and powerful ORM for Go. It makes your
|
|
|
|
// database operation simple.
|
|
|
|
|
2013-06-04 08:56:59 +00:00
|
|
|
package xorm
|
|
|
|
|
|
|
|
type sqlite3 struct {
|
|
|
|
}
|
|
|
|
|
2013-07-03 03:49:29 +00:00
|
|
|
func (db *sqlite3) SqlType(c *Column) string {
|
2013-06-04 08:56:59 +00:00
|
|
|
switch t := c.SQLType; t {
|
2013-08-08 05:24:38 +00:00
|
|
|
case Date, DateTime, TimeStamp, Time:
|
|
|
|
return Numeric.Name
|
|
|
|
case Char, Varchar, TinyText, Text, MediumText, LongText:
|
|
|
|
return Text.Name
|
|
|
|
case Bit, TinyInt, SmallInt, MediumInt, Int, Integer, BigInt, Bool:
|
|
|
|
return Integer.Name
|
|
|
|
case Float, Double, Real:
|
|
|
|
return Real.Name
|
|
|
|
case Decimal, Numeric:
|
|
|
|
return Numeric.Name
|
|
|
|
case TinyBlob, Blob, MediumBlob, LongBlob, Bytea, Binary, VarBinary:
|
|
|
|
return Blob.Name
|
|
|
|
case Serial, BigSerial:
|
|
|
|
c.IsAutoIncrement = true
|
|
|
|
return Integer.Name
|
2013-06-04 08:56:59 +00:00
|
|
|
default:
|
|
|
|
return t.Name
|
|
|
|
}
|
|
|
|
}
|
2013-07-03 03:49:29 +00:00
|
|
|
|
|
|
|
func (db *sqlite3) SupportInsertMany() bool {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2013-08-08 05:24:38 +00:00
|
|
|
func (db *sqlite3) QuoteStr() string {
|
2013-07-03 03:49:29 +00:00
|
|
|
return "`"
|
|
|
|
}
|
|
|
|
|
2013-08-08 05:24:38 +00:00
|
|
|
func (db *sqlite3) AutoIncrStr() string {
|
2013-07-03 03:49:29 +00:00
|
|
|
return "AUTOINCREMENT"
|
|
|
|
}
|
2013-08-08 05:24:38 +00:00
|
|
|
|
|
|
|
func (db *sqlite3) SupportEngine() bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (db *sqlite3) SupportCharset() bool {
|
|
|
|
return false
|
|
|
|
}
|